Terasology: Memory Leak when Creating New Worlds During the Same Session

Created on 27 Apr 2018  路  2Comments  路  Source: MovingBlocks/Terasology

What you were trying to do

~ Creating/loading different worlds during the same session in Terasology; trying out each module in its own separate test world.

What actually happened

~ System memory consumption increased with each world creation/loading. Game configuration is set to "Maximum Memory" 2gb. I would shutdown the session when 5gb were surpassed. Eventually I had to reboot my entire system during long periods of modules trials.

How to reproduce

  • Step 1: Create a new world with only one module.
  • Step 2: Exit that world while leaving Terasology running.
  • Step 3: Repeat Step 1 except deselecting all modules and selecting a different one. Then repeat this process for three more, new worlds.

Log details and game version

~ Terasology: Stable #74
~ Gameplay Template: Core Gameplay

Computer details

~ Linux Mint 18.3
~ 16gb RAM
~ Intel i7

Bug Performance UI

Most helpful comment

Loading a different module each time is actually irrelevant for reproducing this issue. Every time you create or load a game, it creates a new Context, and none of these are garbage-collected when returning to the main menu or start a new game, so all of the systems and things from previous games remain.

I still haven't managed to find out what's keeping the old Context alive, but there is a lot of rendering stuff that also remains even without the references to it from the Context, so it's quite likely that something there is the issue.

All 2 comments

Thanks for the report :-)

This might be a good fit for @TheFlash98's GSOC project as he aims to rework some of the UI flow in that area. As part of that module environment setup may change to more cleanly swap back and forth, avoiding this memory issue. At least we should re-check this with the new setup to make sure it doesn't occur anymore.

Loading a different module each time is actually irrelevant for reproducing this issue. Every time you create or load a game, it creates a new Context, and none of these are garbage-collected when returning to the main menu or start a new game, so all of the systems and things from previous games remain.

I still haven't managed to find out what's keeping the old Context alive, but there is a lot of rendering stuff that also remains even without the references to it from the Context, so it's quite likely that something there is the issue.

Was this page helpful?
0 / 5 - 0 ratings