Fix excessive memory use with large external-level projects - #1246
Open
GameGuyy wants to merge 1 commit into
Open
Fix excessive memory use with large external-level projects#1246GameGuyy wants to merge 1 commit into
GameGuyy wants to merge 1 commit into
Conversation
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1172
Large projects with external levels were crashing the renderer because Electron's V8 heap is capped around 4GB (pointer compression), and every level was kept in memory 3 times: the live data, a parsed LevelJson object, and the pretty-printed JSON string. With the crasher project from the issue this goes over the cap before loading even finishes.
Changes:
.ldtklfile on disk, and reads it back only when actually needed..ldtklfiles are cleaned up after the save succeeds.Single-file projects keep the old in-memory cache, nothing changes for them.
Tested with the crasher project from the issue (55 levels, ~276MB): loads and saves fine now, renderer stays under 1GB where it used to hit 4GB and die. Also checked: saving without edits touches only the main
.ldtkfile, editing one level rewrites only that level's file, level rename/delete, save as to another folder, 0.9.3 project migration, and close/reopen round-trips (multi-world sample included).