Game crashes at specific point - bad_alloc

Just got an allocation error on 223 x64bit Intel:

2015-Mar-18 09:26:49.278378 | server | 0 | lua.memory | error in lua allocator attempting to allocate 32 bytes (boost::interprocess::bad_alloc)
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | lua shared heap size: 520.594 MB. freelist overhead: 148.530 MB (28.53%). total bytes allocated: 669.123 MB.
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | o: outstanding allocs, fl: free list len
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | 80 bytes (o:2528383 fl:1830004 72.38%) : ########################################
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | 32 bytes (o:2114696 fl: 0 0.00%) : #################################
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | 24 bytes (o:1324541 fl: 0 0.00%) : ####################
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | 192 bytes (o: 572102 fl: 0 0.00%) : #########
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | 20 bytes (o: 312033 fl: 0 0.00%) : ####
2015-Mar-18 09:26:49.278378 | server | 1 | lua.memory | … remaining allocs are each < 5% of the count

Game ran just fine up to this point.

Had 14 Hearthlings, was just gathering and moving stuff into cave system and this error and also the log:
stonehearth.log (307.7 KB)

Updated Steam V240 still crashing to windows with a ( error in lua allocator attempting to allocate 1536 bytes (boost::interprocess::bad_alloc)

Win7 x64

Join the club.

1 Like

Seems to be carrying over from build to build.

Hi guys,

On 240 we added an option to disable the Lua JIT in Settings -> System. Turning OFF the JIT should stop the crashing (yay!), but may make the game slower (boo!). If you get a chance, please try it out. I’d love to hear how it goes for you.



I figured that out on my own last night and it does stop the game from crashing due to not being able to allocate new memory. The problem with this is once you get beyond about the 3 gig of ram that I was crashing at consistently with JIT on it just keeps rising very quickly. I believe at the pace it is accumulating memory you likely have a memory leak somewhere. There is just no reason this game should be using 7+ gig of ram.

I would of posted this sooner but I just was able to finally get my account confirmation email.


hey there @Sean61616 … welcome aboard! :smile:

thanks for registering to provide this feedback! :+1:

I love you TR! Thanks to this new setting I can finally play a load of my worlds that I couldn’t fully complete without crashing :smiley:.

But as stated above there is a big issue regarding the memory, My current world (one huge building) is using close to 3 GB, My other world with like 500 goblins is using almost 5 GB. 4.6 GB currently. So I would suspect either a memory leak or there needs to be major rendering.

But apart from that, This is epic! Finally can use more than 3.5GB (almost ordered more ram thinking I was using 5 GB somewhere) You guys are doing amazing! So glad I found this game. :heart_eyes_cat:


Changing the setting did indeed help and the crashing has stopped.

Edit: Before I changed the setting I was trying to build a custom building when I kept getting errors. After my workers are hard at work. Might it be possible there is a direct correlation between the memory leak and the building UI?


My thoughts as well (after just crashing at around 3.5 gigs). I run InDesign, Illustrator and Cinema 4D all at the same time all day with half a dozen files open and their total comes no where near half what this game is using. The CPU use is also way over the top. 40% is crazy when the above mentioned programs total only a fraction of that.

Probably goes without saying that these memory issues will be addressed as time goes by…

Personally, I’d like to see a setting where you can choose how much ram you can allocate to the program, as I have 16gb total personally, and barely use 3 when I’m idle. As for cpu though, I’ll agree that this is way too “hungry”.

1 Like

Agreed! Will investigate.

1 Like

CPU usage should probably go down once they find out what is allocating all this extra memory. Creating new memory all the time is an intensive operation. Aside from that objects that should of been destroyed (and were the memory leak for another game I’ve seen as well) might still be running like from a particle system. Just imagine the game thinking there are a million extra little firepit particles all trying to do their own little thing still :stuck_out_tongue:

Additonally, depending on how its been implemented you might be able to lower the ram usage by lowering the draw distance, but again I’m unsure how this is working in this game. If the game is streaming in information of the land based on draw distance then that would lower ram usage. Thankfully for this game using a BSP (Binary space partitioning) tree for exactly this is really easy to add given its grid structure.

1 Like

True. I have other problems unfortunately. I’m basically shut out of running the game because 64bit won’t run on my AMD rig and 32bit AMD is so unstable as to be unplayable. I run it very occasionally on another machine (the 64bit Intel), but for the most part I can no longer run the game at all. I suppose, for me, I’ll just have to come back in a few weeks (or months) and see if there’s been any progress on 64bit AMD.

I’m curious what you system specs are?

@Ponder, I’m getting this too (7+gigs ram usage @ about 50% CPU) as well as a 212meg save game file. :grimacing:

@SirAstrix, my specs are posted several places here, but it’s a higher end gaming AMD rig with 16gig ram and 4 gig NVIDIA video card and a fast 1T hard drive. To date it can handle anything I throw at it (except this game, haha)


Version : 240 Alpha 9

It is my 17° buiding, the floor created, the wall only one lvl
Crash after the 2° level.

It append all the time after 17° buiding.

Welcome to the forum, @artifus! :smile:

Could you try what is suggested in this post:

and see if you don’t get the crash?
Thanks for reporting.

I can confirm some bad allocation in 240 as well (although I’ve misplaced the actual data from the screen!). I’ve since applied @Ponder’s recommendation of disabling the Lua JIT, and so far, I haven’t seen anything come back up.

Granted, the game in question involves a very large structure with multiple floors and layered slabs, so I’m not surprised if it’s giving the game engine trouble. If anything else comes up, I’ll try to post the information.