delete function doesn't appear to be freeing memory...
by Vince Gee · in Torque 3D Professional · 05/17/2012 (9:32 am) · 3 replies
Got a quick question, has anyone else noticed that when you call %object.delete() it doesn't free the memory shown in the task manager?
At least it appears that way, still researching this, but it's starting to bother me since I don't understand why the ram is creeping up even though I'm deleting objects.
Vince
At least it appears that way, still researching this, but it's starting to bother me since I don't understand why the ram is creeping up even though I'm deleting objects.
Vince
About the author
www.winterleafentertainment.com
#2
Generally, memory in C++ is block allocated, so until you free a bunch, your memory usage will not go down. Some implementations of the C++ compiler actually group objects of a similiar size into different heaps, I wrote a custom block allocator sometime ago to replace the on in a C++/COM application that was having memory issues.
In C++, the object is freed, the memory is available inside the process, but it is not reflected on the task manager. The next allocation that comes through the memory manager looks for a suitable fit inside the chained list of free blocks, if it cannot find one, it adds it to the end.
When blocks are free, the memory manager looks at the chained list to determine if it is adjacient to an already free block so that it can be merged together.
Bottom line is, unless you want to replace the memory manager with one of your own, you are probably just experiencing the default behavior.
05/17/2012 (10:05 am)
That would probably depend on how large the objects are and what else is on the heap.Generally, memory in C++ is block allocated, so until you free a bunch, your memory usage will not go down. Some implementations of the C++ compiler actually group objects of a similiar size into different heaps, I wrote a custom block allocator sometime ago to replace the on in a C++/COM application that was having memory issues.
In C++, the object is freed, the memory is available inside the process, but it is not reflected on the task manager. The next allocation that comes through the memory manager looks for a suitable fit inside the chained list of free blocks, if it cannot find one, it adds it to the end.
When blocks are free, the memory manager looks at the chained list to determine if it is adjacient to an already free block so that it can be merged together.
Bottom line is, unless you want to replace the memory manager with one of your own, you are probably just experiencing the default behavior.
#3
Is their any know bugs with setMoveDestination?
05/17/2012 (10:39 am)
After tracing through the code, it appears that the leak only occurs when I call setMoveDestination on the mob, if it is standing by itself not doing anything there is no leak.Is their any know bugs with setMoveDestination?
Torque Owner Demolishun
DemolishunConsulting Rocks!
www.garagegames.com/community/forums/viewthread/129004
From the thread: