Memory leak in 3362

Sadly I can’t really tell why, but after ~2h or so (I lose track of time in this game, it’s awesome) I seem to encounter some sort of memory leak. The game is up in the region of 5-6GB of RAM usage (16GB installed) which usually causes something or the other to crash (eg firefox, and for the first time today, SH ). After a restart of steam + SH memory usage starts around 2GB loaded into my save.

EDIT: To clarify, it seems the memory leak is quite constant, the problem reveals itself on my computer around the 2h mark, when the memory usage reaches ~5GB

1 Like

Posted this right as I crashed the last time. Firefox just crashed with SH @ ~6GB of RAM use (still a 4GB headroom to the 16GB installed, weird) resulting in me exiting SH for now. Memory usage graph from win10 follows:

A save file would likely be useful here for the team to determine the cause. Also are you playing a21, what mods are you using, did you remove the item limit?

Posting save here as well as my in-game settings. Not sure what you mean about item limit but I don’t think so…
Images of relevant settings:
Save file:

OK. just from what I’ve seen i can likely provide you with an answer.

You have a massive pit in the middle of your town, it’s FULL of items, on top of this theres a HUGE mining area and on top of that, you’ve got like 600+ wood sitting on the ground next to your houses, on top of this you’ve got tons and tons of items sitting around from monster drops and you’re about 500 items from your towns item limit. Added to all this, you still have scaffolding sitting next to a couple of your houses that should have been removed but it looks like you build the road and the scaffolding got stuck. Plus 31 citizens…

Stonehearth is by no means optimized, and i’m guessing by the time you reach this point your system starts to die under the pressure of trying to move over a thousand items at once, WHILE trying to mine more and still trying to get the pathfind to your loot drops from enemies. ON top of it all, the lua pathfinder is working hard to figure out how to finish your buildings by removing the lasts bits of scaffold so it can stop checking them.

Stonehearth unfortunately can’t do that much at once without a really strong computer. (yet) Also it really dislikes large mining areas and the devs suggest you break such areas up a bit so your little people and mainly your computer don’t get overwhelmed.

  1. I do have a quite strong computer.
    (i7-6700k, R9 290X, 16GB RAM DDR4@3000MHz)
  2. The thing is… The ram usage starts around 2.3-2.5GB and slowly slowly rises to the 5-6GB levels after around an hour or more of play. This leads me to believe that it’s more of a memory leak issue rather than a memory management issue, but that might be way off.

The game is by no means optimized so these issues mentioned while not on their own an issue do add up. I’m not an expert but the game ran fine on my pc a dev or somebody else may have a better answer mind you.

Both of you are correct. Stonehearth has not been optimized for memory usage and also has outstanding memory leaks. We’ve actually fixed a few leaks in the recent alphas, but there is at least one significant leak that we still need to find.

@mickwald - Thanks for posting your save and providing details! We’ll take a look and see what we can find.


I actually have somewhat same issue, and on every save. The more I play, the more is the RAM usage, and eventually game just shuts down. It’s like a sink that’s getting filled with water. When I reopen it’s back to normal RAM usage, but it still increases over time. Happens regardless of mods. Sadly all I can do is sit and hope for it to get fixed, don’t have any coding knowledge to help.

Edit: Also, yes, kinda late on the reply since this was made in march

March of 2 years ago (2017). This was also regarding the release A21, not the current release of 1.1. The game is very dependent on your CPU. Even those of us with beefier computers, do need to save the game every few hours so you can exit and relaunch the game. The RAM usage will increase over time, but you can limit crashes by relaunching the game every few hours.

1 Like

to be fair, this might still indicate a memory leak -somewhere-