Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential RAM savings, up to 1GB #1245

Open
Uristqwerty opened this issue Feb 16, 2024 · 0 comments
Open

Potential RAM savings, up to 1GB #1245

Uristqwerty opened this issue Feb 16, 2024 · 0 comments

Comments

@Uristqwerty
Copy link

Upon launching the Vault Hunters modpack (current release, 3.13.0), I noticed it had fairly high memory usage, so took a quick heap dump on the main menu to see if there was an optional mod I could disable or config I could tweak to reduce it somewhat with minimal gameplay impact.

Instead, I quickly noticed that there are a lot of PartialCompoundNBT instances from the_vault itself, yet nearly every single one of them was empty. I do not know if the game will mutate them later on or rely on identity inequality, justifying them being separate allocations despite being functionally identical, but if all of the empty ones can be modified to point to a singleton you should be able to drastically cut down on the pack's overall system requirements.

image

If you want to try reproducing my findings, take a heap dump at any point using your tool of choice, load it up into the Eclipse Memory Analyzer, and run a Component Report to see how many empty HashMaps it can find automatically. Or poke around manually in VisualVM, or any other tool that lets you explore Java heaps/dumps.

I haven't bothered to check whether there is much BlockPos duplication as well, so there might be a further hundred MB or two that can be optimized out.

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

No branches or pull requests

1 participant