T3D MIT 2.0 VectorResize / realloc_r memory leak with forests
by Michael Bolland · in Torque 3D Professional · 04/05/2013 (7:07 am) · 3 replies
Build: T3D MIT 2.0
Platform: Windows 7 64 bit 4Gb ram
Target: Fly Cam
Issues:
My problem
I was getting crashes every 4 minutes with my stock t3d mit 2.0 client when trying to work on my map and i couldn't understand it as i wasn't getting anything in the console.log and i'm not a c++ developer or anything to really understand how to track it down in the engine
The Cause
With some help with the guys in maxgaming IRC channel they helped me compile a debug mode client and track down the cause of the crash
To get the crash to happen I would fly around the map until the crash occured and it would return an error VectorResize - Allocation Failed - usually this took about 4 minutes or so
Looking at the call stack when this occured it appeared that the VectorResize was being called by the ForestCell:buildBatches() method so it was clickly apparent this was being caused by the forest - i use the conifer forest pack by the way
Xifos in the IRC channel asked me to add some breakpoints to see if VectorResize was doing an allocate or a reallocate - we tested this and it was using Realloc_r. He then asked me to step through each breakpoint as I moved around my map looking at new areas of the forest and watch my memory usage - it seemed to rise 200mb from 1.6gb to 1.83gb and then at that point it would crash
He suggested this might be a memory leak but resolving it was beyond him so he suggested I post here - so here you go!
For now I have scrapped my map and creating a much smaller one that is using around 1.2gb ram on idle and so far I have had 0 crashes over the last 3 hours
Steps to Repeat:
1. Load up Torque 2.0 MIT
2. Load a map that uses around 1.6gb ram with a large forest and all your assets
3. Fly around the map and watch the memory usage increase until the client crashes
Platform: Windows 7 64 bit 4Gb ram
Target: Fly Cam
Issues:
My problem
I was getting crashes every 4 minutes with my stock t3d mit 2.0 client when trying to work on my map and i couldn't understand it as i wasn't getting anything in the console.log and i'm not a c++ developer or anything to really understand how to track it down in the engine
The Cause
With some help with the guys in maxgaming IRC channel they helped me compile a debug mode client and track down the cause of the crash
To get the crash to happen I would fly around the map until the crash occured and it would return an error VectorResize - Allocation Failed - usually this took about 4 minutes or so
Looking at the call stack when this occured it appeared that the VectorResize was being called by the ForestCell:buildBatches() method so it was clickly apparent this was being caused by the forest - i use the conifer forest pack by the way
Xifos in the IRC channel asked me to add some breakpoints to see if VectorResize was doing an allocate or a reallocate - we tested this and it was using Realloc_r. He then asked me to step through each breakpoint as I moved around my map looking at new areas of the forest and watch my memory usage - it seemed to rise 200mb from 1.6gb to 1.83gb and then at that point it would crash
He suggested this might be a memory leak but resolving it was beyond him so he suggested I post here - so here you go!
For now I have scrapped my map and creating a much smaller one that is using around 1.2gb ram on idle and so far I have had 0 crashes over the last 3 hours
Steps to Repeat:
1. Load up Torque 2.0 MIT
2. Load a map that uses around 1.6gb ram with a large forest and all your assets
3. Fly around the map and watch the memory usage increase until the client crashes
#2
04/09/2013 (7:30 am)
I don't know about a memory leak or not but we had the same problem with a single huge level. Once you get close to the 2 GB Memory limit it will cause crashes. I worked for weeks trying to get the level down to a manageable size by removing most normal maps, and reducing everything including hard-coding the texture quality level to low and finally said, man this looks like hammered dog do and scrapped the one huge level idea and created a bunch of new smaller levels. Not the solution you're looking for...just sharing your pain...lol
#3
04/09/2013 (8:19 am)
Some of us only have 2Gb of RAM to begin with ... :(
Torque Owner Michael Bolland