meanwhile, either open taskmanager and run this while watching memory usage change pre-DIM to post-:
// Project: LCS Arrays
// Created: 2023-07-15
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "LCS Arrays" )
SetWindowSize( 640,360, 0 )
SetWindowAllowResize( 1 )
// set display properties
SetVirtualResolution( 640,360 )
SetOrientationAllowed( 1, 1, 1, 1 ) // portrait, portrait2, landscape, landscape2
SetSyncRate( 30, 0 )
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )
Repeat
Print("Pre-DIM")
Sync()
Until GetPointerPressed()
Print("POST-DIM")
Sync()
global breakLoop `1=Break main game loop and return to main menu.
global ticks `Call map script and advance time every 180 ticks.
global ticksMech `Update game mechanics every 3 ticks.
global storyName$ `Name of current story/chapter.
global storyFail `1=Main story has failed and saving has been disabled.
global touchScreen `Touchscreen mode (set in code only).
global demoVersion `Demo version (first 5 maps only).
global linuxVersion `Linux verison (disable File Explore plugin).
global worldEditor `World Editor enabled.
global editorMode `1=Editor mode is turned on.
global editorX `Selected tile X in editor mode.
global editorY `Selected tile Y in editor mode.
global editorLast$ `Last edit string input.
global checkX `Temp variable for pathfinding.
global checkY `Temp variable for pathfinding.
global mapGen `Temp variable for map generator.
global time `Time of day (1 to 600).
global days `Days passed in current story.
global gameOverCnt `Game over countdown (60 ticks, or 1 second).
global map `Currently loaded map.
global mapDrawn `Map already drawn (cut out messages/sounds beforehand).
global dialogWin `Dialogue window is currently open.
global camX# `Camera position X.
global camY# `Camera position Y.
global camZoom# `Camera zoom.
global numImages `Number of images.
global numObj `Number of objects.
global numMob `Number of mobile objects.
global keyDelay `Delay after pressing certain keys.
global paused `Pause game (0=no, 1=yes, 2=editor, 3=item target, 4=ability target).
global command `Command (0=move, 1=get/use, 2=talk, 3=look, 4=attack).
global menuSettings `Selected option in settings menu (0 to 10).
global msgSize `Message window size (1=big).
global mouseHold `Left mouse button is held (for drag selection).
global mouseXSel `Drag selection start X.
global mouseYSel `Drag selection start Y.
global mouseXOld `Old mouse X (for tool tips).
global mouseYOld `Old mouse Y (for tool tips).
global mouseStill `Ticks passed since last mouse movement (for tool tips).
global journalTab `Current journal tab (0=quests, 1=reputation, 2=options).
global wealth `Player's wealth.
global points `Player's skill points.
global partyLvl `Party Level = (size*5) + total karma spent.
global weather$ `Current weather (0=clear, 1=rain, 2=snow, 3=fog, 4=hail).
global weatherX `Current X position of weather overlay.
global weatherY `Current Y position of weather overlay.
global weatherMoveX `X movement of weather overlay.
global weatherMoveY `Y movement of weather overlay.
global weatherOpacity `Opacity of weather overlay (0 to 100).
global weatherGlue `Weather overlay doesn't move with screen scrolling.
global weatherAim `Aim modifier for map (usually based on weather).
global screen$ `Current background scene (for maps, etc.).
global dialog$ `Dialogue text (if not blank, game is in dialogue).
global response$ `Player's response to dialog window.
global command$ `Script command.
global value$ `Script parameter (complete).
global val1$ `Script parameter #1.
global val2$ `Script parameter #2.
global targX `Current X target (for item and ability targets).
global targY `Current Y target (for item and ability targets).
global shop `If 1, player is currently shopping.
global shopInv `Selected inventory slot while shopping.
global game$ `Selected save/story in main menu.
global ambOld$ `Old ambient sound (for changing ambience).
global musOld$ `Old music (for changing music).
global gameoverScr$ `Script to run on gameover (reset when map changes).
global victoryMusic `If 1, short victory music is currently playing.
global cursor$ `Current custom cursor (leave blank for default).
global hideHUD `If 1, HUD is currently hidden (H key).
global playerObj `Object ID of main player (gameover if dead).
global playerMap `Map ID of main player (for world editor only).
global curObj `Currently-selected object for scripts.
global lstObj `Last currently-selected object for nested scripts.
global defObj `Default object that triggered current script.
global itmObj `Item currently being used for paused targeting.
global trgObj `Party mobile that is currently in targeting mode.
global menuSound `Temp sound variable for returning to main menu.
global menuMusic `Temp music variable for returning to main menu.
global settingsAI `Party AI level (0-2).
global settingsMusic `Music volume (0-3).
global settingsSound `Sound volume (0-3).
global settingsTips `Tool tip speed (0-3, 0=off).
global settingsGlint `Item glint frequency (0-3, 0=off).
global settingsScreen `Fullscreen mode (1=on).
`Basic arrays.
dim mapNumObj[999] `Number of objects on map.
dim checkTemp[10000] `Temp object checks for script commands like "pickName".
dim itemCount[10000] `Temp check for player picking up multiple items at once.
dim image$[9999] `Image filenames.
dim message$[20] `Game messages.
dim storyList$[20] `Temp list for list of stories and saves.
dim var[999] `Game variables for scripts.
dim partyRoster[25] `Up to 25 party members (5 main, 20 henchmen).
dim missileX#[10] `Up to 5 missiles at once (X destination).
dim missileY#[10] `Up to 5 missiles at once (Y destination).
dim choices$[6] `Up to 6 max choices in dialogue windows.
dim lines$[6] `Up to 6 lines of text (using /r to go to next line).
dim locked$[20] `List of locked stories (chapters).
`Game constants (globals script).
global pacesName$ `Name of tile units.
global weightName$ `Name of weight units.
global wealthName$ `Name of wealth units.
global pointsName$ `Name of point units.
global healthName$ `Name of health units.
global metaName$ `Name of meta units.
dim damageName$[10] `Names of the 10 types of damage (melee, etc.).
dim factionName$[10] `Names of the 10 factions (0=neutral, 1=player).
dim factionReact[10] `Reaction of faction towards player (0-100).
dim reputations$[100] `Party reputations (carried over to other chapters).
dim objectives$[100] `Party objectives (not carried over to other chapters).
`Skill/Ability properties.
dim skillName$[10] `Skill name.
dim abilityName$[100] `Ability name.
dim abilityImg$[100] `Ability icon.
dim abilityDesc$[100] `Ability description.
dim abilityTarg[100] `Ability target (0=passive, 1=self, 2=other).
dim abilityRange[100] `Ability range.
dim abilityCost[100] `Ability meta cost to use.
dim abilityScr$[100] `Ability script.
dim abilityReq[100,1] `Ability required skill (2nd dim is amount).
`Effect properties.
`Bonus Attributes: 1-10=Resist, 11=Max Health, 12=Max Energy,
`13=Max Load, 14=Damage, 15=Evasion, 16=Aiming.
dim statusName$[50] `Names of the 10 mobile effects (poison, etc.).
dim statusMax[50] `Max level of effect (up to 100).
dim statusDam[50] `Health damage every 3 seconds (negative for heal).
dim statusDType[50] `Health damage type every 3 seconds.
dim statusDrain[50] `Meta drain every 3 seconds.
dim statusSpeed[50] `Speed adjustment (-4 to 4).
dim statusConfused[50] `If 1, mobile walks in random directions occasionally.
dim statusBerserk[50] `If 1, mobile automatically attacks adjascent mobiles.
dim statusSleeping[50] `If 1, mobile is asleep.
dim statusConcealed[50] `If 1, mobile is concealed from sight.
dim statusSpotting[50] `If 1, mobile is can see concealed objects.
dim statusNoTip[50] `If 1, status is not shown in tooltips.
dim statusBonus[50,1] `Effect attribute bonus (if 2nd dim=1 then decrease).
dim statusBonus2[50,1] `2nd effect increases attribute (if 2nd dim=1 then decrease).
dim statusRed[50] `Red color correction for object with this status.
dim statusGreen[50] `Green color correction for object with this status.
dim statusBlue[50] `Blue color correction for object with this status.
dim statusRecover#[50] `If 1, effect decreases every second, if -1 it increases.
`Map properties.
dim mapName$[999] `Name of map.
dim mapSizeX[999] `Map size X (30 to 100).
dim mapSizeY[999] `Map size Y (30 to 100).
dim mapTile$[100,100,999] `Map terrain PNG tile (x, y, map).
dim mapBlock[100,100,999] `Tile blocks movement (1=yes).
dim mapBlockFly[100,100,999] `Tile blocks flying (1=yes).
dim mapBlockVis[100,100,999] `Tile blocks sight (1=yes).
dim mapDrawPri[100,100,999] `Tile draws over non-flying objects (1=yes).
dim mapWater[100,100,999] `Tile requires swimming (1=yes).
dim mapIndoors[100,100,999] `Tile is indoors (1=yes).
dim mapMusic$[999] `Map music during the day.
dim mapMusicNight$[999] `Map music during the night.
dim mapAmbient$[999] `Map ambient during the day.
dim mapAmbientNight$[999] `Map ambient during the night.
dim mapScr$[999] `Map script, run every 3 seconds.
dim mapRed[999] `Map red tint (0-255).
dim mapGreen[999] `Map green tint (0-255).
dim mapBlue[999] `Map blue tint (0-255).
dim mapNoNight[999] `Map day/night cycle disabled if 1.
`Object properties.
dim objName$[10000,999] `Name of object (blank=none).
dim objImg$[10000,999] `Image filename (PNG).
dim objMat$[10000,999] `Material of object.
dim objDesc$[10000,999] `Description of object.
dim objEdit[10000,999] `If 1, object is only visible in Editor mode (waypoints).
dim objType[10000,999] `Type (0=normal, 1=item, 2=mobile, 3=usable, 4=effect).
dim objPosX[10000,999] `Position X.
dim objPosY[10000,999] `Position Y.
dim objDestX[10000,999] `Current X destination.
dim objDestY[10000,999] `Current Y destination.
dim objDestXTemp[10000,999] `Temp X destination (for collision avoidance).
dim objDestYTemp[10000,999] `Temp Y destination (for collision avoidance).
dim objHE[10000,999] `Current health/condition of object.
dim objHEMax[10000,999] `Max health/condition of object.
dim objME[10000,999] `Current meta/charges of object.
dim objMEMax[10000,999] `Max meta/charges of object.
dim objLoadMax[10000,999] `Max load object can carry/contain.
dim objInv[10000,10,999] `Object's inventory/contents.
dim objEquip[10000,999] `Currently equipped item slot (1-20).
dim objRes[10000,10,999] `Object's resistance to the 10 types of damage.
dim objTable[10000,999] `If 1, object acts as a table.
dim objBlock[10000,999] `Object blocks movement (1=yes).
dim objBlockFly[10000,999] `Object blocks flying (1=yes).
dim objBlockVis[10000,999] `Object blocks sight (1=yes).
dim objColX[10000,999] `X collision size (odd numbers only).
dim objColY[10000,999] `Y collision size.
dim objSelX[10000,999] `X selection size.
dim objSelY[10000,999] `Y selection size.
dim objFlip[10000,999] `Object sprite flipped horizontally.
dim objDrawPri[10000,999] `Draw (0=normal, 1=over, 2=under, 3=bottom).
dim objConcealed[10000,999] `Object hidden (only visible with spotting status effect).
dim objFaction[10000,999] `Object faction (0-10, 0=none, 1=player).
dim objSpeed[10000,999] `Mobile's pixels object moves each tick (max=5).
dim objTemp[10000,999] `If 1, object is deleted after leaving map (blood+vomit).
dim objFrameSize[10000,999] `X+Y pixel size of each frame in sprite sheet.
dim objParent[10000,999] `Parent object (for inventory mostly).
dim objWaypoint[10000,999] `Object acts as a waypoint for AI (doorways, etc.).
dim objScrUse$[10000,999] `Object use script.
dim objScrAtt$[10000,999] `Object attack script.
dim objScrGet$[10000,999] `Object get script.
dim objScrDrp$[10000,999] `Object drop script.
dim objScrDam$[10000,999] `Object damage script.
dim objScrDie$[10000,999] `Object death script.
dim objScrCol$[10000,999] `Object collision script.
dim objScrSel$[10000,999] `Object select script.
dim objScrChk$[10000,999] `Object AI check script (run every second).
`Item properties.
dim objItmType[10000,999] `Item type (0=none, 1=useable, 2=weapon).
dim objItmTarg[10000,999] `Item target type (0=self, 1=other).
dim objItmCnt[10000,999] `Item count (max=100, only if HE and ME are <1).
dim objItmSpr$[10000,999] `Item overlay on mobile sprite when equipped.
dim objItmWeight[10000,999] `Item weight.
dim objItmAnim[10000,999] `Item use anim (0-6).
dim objItmDelay[10000,999] `Item use speed.
dim objItmDam[10000,999] `Weapon base damage.
dim objItmDType[10000,999] `Weapon damage type.
dim objItmRange[10000,999] `Weapon range.
dim objItmAim[10000,999] `Weapon ranged aim.
dim objItmAmmo[10000,999] `Ammo type for weapons.
dim objItmAmmoReq[10000,999] `Required ammo.
dim objItmWpnType$[10000,999] `Weapon type (for ability scripts only).
dim objItmValue[10000,999] `Value of item at merchants.
`Mobile properties.
`Mobile tasks: 0=Idle, 1=Use, 2=Thrust, 3=Walk, 4=Slash, 5=Shoot, 6=Die.
`Mobile skills: 1=Vitality, 2=Willpower, 3=Physique, 4=Cunning, 5=Education.
dim objMobDir[10000,999] `Mobile's direction (0=N, 1=S. 2=E, 3=W).
dim objMobTask[10000,999] `Mobile's current task (0-6).
dim objMobSpecies$[10000,999] `Mobile's species.
dim objMobSkill[10000,20,999] `Mobile's skills (0-20).
dim objMobAbility[10000,10,999] `Mobile's abilities (each one set to an ability ID#).
dim objMobStatus#[10000,50,999] `Mobile's level of each status effect.
dim objMobDType[10000,999] `Mobile's unarmed damage type.
dim objMobRange[10000,999] `Mobile's unarmed range.
dim objMobSwim[10000,999] `Mobile's pixels object swims each tick (max=5).
dim objMobMelee[10000,999] `Mobile's bonus melee damage.
dim objMobAiming[10000,999] `Mobile's ranged aiming bonus.
dim objMobEvade[10000,999] `Mobile's evasion percent chance.
dim objMobAquatic[10000,999] `Mobile can swim if 1, water only if 2, sand only if 3.
dim objMobFlying[10000,999] `Mobile is flying.
dim objMobFlee[10000,999] `Mobile flees at given health percent.
dim objMobInParty[10000,999] `Mobile is a main player (2=mobile is a henchman).
dim objMobAb[10000,999] `Mobile's currently selected ability.
`Effect properties.
dim objEffLife[10000,999] `Effect's lifespan (0=infinite).
dim objEffRange[10000,999] `Effect's range (affects nearby tiles).
dim objEffSpeed[10000,999] `Effect's animation speed (unrelated to move speed).
dim objEffFadeOut[10000,999] `If 1, effect fades out when its life runs out.
dim objEffNoParent[10000,999] `If 1, effect does not affect parent object.
`Mobile animation frames.
`Dim2: 0=start, 1=end.
dim objAnimIdleN[10000,1,999] `Idle animation frames (facing north).
dim objAnimIdleS[10000,1,999] `Idle animation frames (facing south).
dim objAnimIdleE[10000,1,999] `Idle animation frames (facing east).
dim objAnimIdleW[10000,1,999] `Idle animation frames (facing west).
dim objAnimUseN[10000,1,999] `Item/magic animation frames (facing north).
dim objAnimUseS[10000,1,999] `Item/magic animation frames (facing south).
dim objAnimUseE[10000,1,999] `Item/magic animation frames (facing east).
dim objAnimUseW[10000,1,999] `Item/magic animation frames (facing west).
dim objAnimThrustN[10000,1,999] `Thrust animation frames (facing north).
dim objAnimThrustS[10000,1,999] `Thrust animation frames (facing south).
dim objAnimThrustE[10000,1,999] `Thrust animation frames (facing east).
dim objAnimThrustW[10000,1,999] `Thrust animation frames (facing west).
dim objAnimWalkN[10000,1,999] `Walk animation frames (facing north).
dim objAnimWalkS[10000,1,999] `Walk animation frames (facing south).
dim objAnimWalkE[10000,1,999] `Walk animation frames (facing east).
dim objAnimWalkW[10000,1,999] `Walk animation frames (facing west).
dim objAnimSlashN[10000,1,999] `Slash animation frames (facing north).
dim objAnimSlashS[10000,1,999] `Slash animation frames (facing south).
dim objAnimSlashE[10000,1,999] `Slash animation frames (facing east).
dim objAnimSlashW[10000,1,999] `Slash animation frames (facing west).
dim objAnimShootN[10000,1,999] `Shoot animation frames (facing north).
dim objAnimShootS[10000,1,999] `Shoot animation frames (facing south).
dim objAnimShootE[10000,1,999] `Shoot animation frames (facing east).
dim objAnimShootW[10000,1,999] `Shoot animation frames (facing west).
dim objAnimDeath[10000,1,999] `Death animation.
`Temp variables for current map.
dim objSelected[10000] `Mobile is currently selected.
dim objTransX[10000] `Temporary X transition to next tile.
dim objTransY[10000] `Temporary Y transition to next tile.
dim objSpriteHUD[10000] `Selection sprites attached to mobile (1-25).
dim objDirOld[10000] `Previous direction of object.
dim objDelay[10000] `Object delay (negative for script timers).
dim objChecks[10000] `Passive checks every second (usually for AI).
dim objMobCmd[10000] `Mobile object's current command.
dim objMobTarg[10000] `Mobile's current target (use, get, or attack).
dim objMobPathX[10000,5] `Mobile pathfinding steps, X.
dim objMobPathY[10000,5] `Mobile pathfinding steps, Y.
dim objEffDie[10000] `Effect object shrinkage on death (30 frames).
do
Print( ScreenFPS() )
Sync()
loop
or trust my findings that you are allocating up to ~4GB of RAM doing it this way. it cripples my laptop (and crashes).
Consider sizing arrays dynamically and
Type-ing as much of that as possible