Welcome, Guest! Login | Register
Compiled multi-level load ram leaks fix
Info
Report
73 Posts

SYMPTOM: load to/from a main menu and a game level increases ram use until you run out of ram, at which stage it crashes. good news is leaks do not increase noticeably or at all during play on same level whether for 1min or 1hr.

TO TEST MEMORY LIMITS: use win7 task manager to monitor commit or peak working set [or ProcessHacker=Pvt. mem or peak working set] while your game runs windowed. from my tests, a 64mb game leaks 20mb each load, and a 230mb game leaks 50mb.

TO FIX: athanatos's idea of 'using iObjectRefresh to load maps from other levels' will work, but for levels with different paths/weapons/waypoints it will get messy and increase load times with too many unused objects, so here's my 2 fixes:

1. [EASY] - add a counter to exitfades, when the amount of loads reaches a limit [say 30 x 50mb loads=1.5gb added to 230mb] warn users to restart the game and force the game to exitfade to windows, which will clear all the ram added. you can also increase 3drad 32bit 2gb limit on 64bit OS to 4gb with the well known '4gb patch' from https://ntcore.com/?page_id=371

2. [ADVANCED] bypass 3drad's level load system completely - there will be NO major ram leaks at all with this method!!!

-compile all levels separately, extract from each 3DRad_res folder 'runproject.rup' for each compile and rename all except main menu to runproject1.rup, runproject2.rup, etc.
-put all these in the main menu's 3DRad_res folder, also put all the exe's in the same folder as main menu exe [each named level1.exe, level2.exe etc] as well as combining all the other 3DRad_res folders overwriting it so all assets are together

-[optional] to stop users playing levels they've not unlocked, pack all game exe's into 1 data file [not main menu unless packing everything to 1 exe] ideally with a paid encrypted packer if protection needed

-levels are loaded by scripting iFileDelete/iFileCopy to make the level's runproject2.rup to runproject.rup [after copying menu .rup to runproject0.rup for future use] then iCommand prior to exitfades to load batch files - simply a .bat for each exe in same folder as menu's exe with the line: level2.exe

-to stop settings dialog each level load you can either:
a. compile as maximized [borderless window]
b. for fullscreen compiles use iSettingsDialogDisable to disable it when exit main menu to any level, and enable it when exiting the game, you also will have to set exitfade times to 0 so fullscreen windows don't crash when bat is loaded on the previous script line.

....this may seem like a lot of work, but it's far quicker/easier to implement then learning a new engine/language.

CREDITS: a big thanks to kulu for making us aware of this issue, and to athanatos for keeping me on my toes [i don't accept random statements until i see the hard numbers/stats for myself] more info on this issue is available on their threads:

[end of page 1] - https://classdev.net/page/thread/1JR6pG_ywd8r0Gyo/rock-climber-new-project

https://classdev.net/page/thread/1L2eo5_tYTgdCXpY/major-memory-leak-when-loading-projects-in-3d-rad
Created on: 1 month ago
Edited on: 1 month ago
Reply
Preview
Post
Or use the advanced reply form here...
Sponsored