You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Any way to support >4GB RAM allocations or save/load with a smaller mem footprint? #1172
I've been making some irresponsibly sized worlds, trying to push into the multi-million tile mark with 16px, 256 tile levels. I can get to around 22 levels in my world grid ('save levels to separate files' ON) before loading (and, later, saving) hits a memory footprint of >4 gigabytes and the screen goes blank.
This throws Error sending from webFrameMain: Error: Render frame was disposed before WebFrameMain could be accessed at s.send (node:electron/js2c/browser_init:2:86534) at _.send (node:electron/js2c/browser_init:2:72329) at BrowserWindow.<anonymous> (/tmp/.mount_ldtk.A4urIbY/resources/app.asar/assets/main.js:67:41) at BrowserWindow.emit (node:events:513:28) in my terminal window if I try to exit.
I got my own build of LDtk going with trace-gc and --max-old-space-size=16384 in all of the various locations recommended to me around the web (export to path, run with electron in package.json, WebPreferences, to name just a few) and caught OOM error in V8: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory while loading my big map, which initially had me under the impression it was Electron's V8 memory cage. After trying again with both gerhardberger's v8 sandbox disabled release, as well as multiple pre-v21 releases before V8, I am still getting the blank screen crash. Albeit, without any obvious V8-related error reports, but nevertheless always shortly after hitting the 4gig allocation point.
That's taken me to the limit of my personal familiarity with the topic. Currently neither 'save levels to separate files' nor 'multi-worlds support' offer the kind of lazy loading functionality needed to only have a portion of the project in mem at a time to lower the memory overhead while saving and loading. Is there any obvious way to beat this?
As concerns replication instructions, you can start up a project and scroll out in the view pane so that when you right-click a level you get the options for duplication. Then you duplicate levels, saving periodically, until you get the blank screen in the middle of saving, at which point the project will likely be too big to load again as well. You can increase how many level files you can have at once by going to the project settings tab and checking "Save levels to separate files" but that will still max out at some point as well. Keep your OS's process monitor open to the side and you'll see how the mem usage increases during saves and loads, and the crash happens shortly after you crest the 4th gigabyte.
I'll have some time tomorrow to dig around for my work building from source with the various logs and flags, if I find it and you're interested I'll upload.
I've found the issue and it pertains to the caching of json data from the levels being loaded.
In a quick check i've disabled that and was able to load the crasher project (its also way faster compared to before) .
However, i think disabling this completely might not be ideal... should there be a global option to disable the caching to make it possible to load these kinds of projects? Thanks.
Thank you for this, I've run into this issue in the last few weeks (I don't think my project is even irresponsibly large) and lost some significant work but wasn't able to find any guidance or others experiencing the issue. I'm going to prune some levels/maps we're no longer using to reduce file size to hopefully keep me working until 1.5.4 is out.
Is this caching something I can disable myself as a not super technical user or is this more of a "wait for 1.5.4" kinda deal?
Just wanted to bump this. It fixes a renderer OOM crash on large external-level projects (#1172). Tested against the crasher project from that issue: renderer memory stays under 1GB now, where it previously blew past the ~4GB V8 heap cap and crashed before load even finished. Happy to address any review feedback.
Activity
daniel-brenot commentedon Jul 15, 2025
If anyone feels like solving this issue, there is now a 100$ USD bounty on it.
Bounty link here:
https://gitpay.me/#/profile/task/1220/any-way-to-support-4-gb-ram-allocations-or-save-load-with-a-smaller-mem-footprint
parvit commentedon Jul 17, 2025
@MikeECunningham Hi, could you share a file that triggers this behavior or some more specific steps to recreate the map?
daniel-brenot commentedon Jul 17, 2025
My man coming in clutch on another bounty. You rock
MikeECunningham commentedon Jul 18, 2025
This fails to load for me on both my Ubuntu and Windows partitions.
crasher-proj.zip
MikeECunningham commentedon Jul 18, 2025
As concerns replication instructions, you can start up a project and scroll out in the view pane so that when you right-click a level you get the options for duplication. Then you duplicate levels, saving periodically, until you get the blank screen in the middle of saving, at which point the project will likely be too big to load again as well. You can increase how many level files you can have at once by going to the project settings tab and checking "Save levels to separate files" but that will still max out at some point as well. Keep your OS's process monitor open to the side and you'll see how the mem usage increases during saves and loads, and the crash happens shortly after you crest the 4th gigabyte.
I'll have some time tomorrow to dig around for my work building from source with the various logs and flags, if I find it and you're interested I'll upload.
parvit commentedon Jul 18, 2025
@MikeECunningham thanks the file does reproduce the issue on my debug build also. I'll search for the root cause now.
parvit commentedon Jul 18, 2025
I've found the issue and it pertains to the caching of json data from the levels being loaded.
In a quick check i've disabled that and was able to load the crasher project (its also way faster compared to before) .
However, i think disabling this completely might not be ideal... should there be a global option to disable the caching to make it possible to load these kinds of projects? Thanks.
MikeECunningham commentedon Jul 18, 2025
@deepnight Any input on how to proceed here? Is the caching critical?
parvit commentedon Jul 18, 2025
Adding the option was easier than i thought so i've already prepared the PR. Please review it.
parvit commentedon Aug 5, 2025
Based on the comments by @deepnight on the first PR i've sent a simpler PR without the option (but fixes the issue nonetheless).
sam-gwala10 commentedon Dec 18, 2025
“Hi, I’d like to work on this issue and submit a PR. Can you assign it to me?”
wy477wh173 commentedon May 11, 2026
Thank you for this, I've run into this issue in the last few weeks (I don't think my project is even irresponsibly large) and lost some significant work but wasn't able to find any guidance or others experiencing the issue. I'm going to prune some levels/maps we're no longer using to reduce file size to hopefully keep me working until 1.5.4 is out.
Is this caching something I can disable myself as a not super technical user or is this more of a "wait for 1.5.4" kinda deal?
Merge pull request #1 from GameGuyy/fix/level-json-disk-cache
GameGuyy commentedon Sep 9, 2026
Just wanted to bump this. It fixes a renderer OOM crash on large external-level projects (#1172). Tested against the crasher project from that issue: renderer memory stays under 1GB now, where it previously blew past the ~4GB V8 heap cap and crashed before load even finished. Happy to address any review feedback.
Fix excessive memory use with large external-level projects (#1172)