Skip to content

Conversation

@parvit
Copy link

@parvit parvit commented Jul 18, 2025

This PR fixes #1172.

When loading projects which are bigger than usual (~40 levels) the level json caching mechanism allocates a lot of memory and requires more than 4GB of memory, which blocks the editor.

The PR adds a new global ui option levelJsonCacheActive with default value true, that allows create/load these big projects by disabling the caching mechanism.

Included in the change also the UI change to handle the option in line with similar options in the UI already present.

Please review and send feedback.

@deepnight
Copy link
Owner

The big drawback with caching being disabled is that all save operations will require to rebuild JSON for each level even if it didn't really change. Maybe there's a better way to achieve good saving speed without caching 🤔

I will have a look to this when I will get back to ldtk.

@deepnight deepnight self-assigned this Jul 24, 2025
@parvit
Copy link
Author

parvit commented Jul 24, 2025

The big drawback with caching being disabled is that all save operations will require to rebuild JSON for each level even if it didn't really change. Maybe there's a better way to achieve good saving speed without caching 🤔

I will have a look to this when I will get back to ldtk.

Of course, let me know if you have a different approach in mind and i'll investigate it.

EDIT: I just thought of something, maybe keeping an internal level boolean that indicates if the level has changed and copy the json from the original file on save might be a better solution?

@parvit
Copy link
Author

parvit commented Aug 5, 2025

I've just sent a different PR which i think might have a better approach without disabling the cache, #1185 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any way to support >4GB RAM allocations or save/load with a smaller mem footprint?

2 participants