Skip to content

Severe memory leak when using room previews #664

@Appulcake

Description

@Appulcake

I am not using performance mods.

  • Confirm

Description

Whenever opening a room's preview, it requires an immense amount of memory, and every time a preview is opened it indefinitely accumulates that extra memory load for the rest of the session.

This leads to

  1. every time you open a preview, a huge chunk of committed system memory gets taken up extra by the JVM, so you can only open so many previews in a game session before your whole system is entirely out of memory until you restart the game
  2. complete game OOM crashes as even one more complex preview can take up 100GB+ of RAM

Larger CM sizes have a larger impact (a 45x45x45 empty CM adds ~1GB of committed memory usage every time its previewed, while a 15x15x15 adds ~0.5GB), and also machines with more blocks/block entities inside (with even fairly simple setups using say a couple Oritech and/or Mekanism machines, a 45x45x45 CM's preview can quickly balloon to 50-100GB+ of required total system memory to run, which means even previewing it once in a gameplay session will likely cause the game to crash OOM and/or cause the entire PC to come to a crawl).

The issue started around when the previews crashing entire have been addressed here: #610, very similar to those last few replies in that issue

Mod Version

compactmachines-neoforge-7.0.81

Forge Version

21.1.229

Link to Crash Log

No response

Screenshot (if available)

Gif showing accumulating commit charge of java process every time a preview is opened Image

How to reproduce

  1. Place down a CM, enter it with a Personal Shrinking Device once, then come out
  2. Right click the CM (without a PSD, with e.g. empty hand) to load preview, close preview, repeat
  3. Watch as the commit memory of the java process increases immensely every time the preview is loaded, accumulatively - which means with a 45³ CM within a couple tens of repeated previews of an empty box the game's process will already be using tens of GBs of committed memory - the effect is far worse with a larger CM, and/or with more blocks inside, but can already be reproduced by just previewing a simple empty 15³ machine for example

Metadata

Metadata

Assignees

No one assigned

    Labels

    21.1Relates to CM7 for MC 21.1triageunverifiedIssue needs to be verified beyond initial report, or due to an old version.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions