GarageGames / Torque2D

MIT Licensed Open Source version of Torque 2D game engine from GarageGames

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After delete SimObject, the memory is still not free all.

kynora opened this issue · comments

I try to run simulate create 100000 SimObjects. Each object have fields value.
All object consume about 40 mb of memory, after delete all objects. only 30mb are free and still remaining about 10mb.
Are those fields values still keep in memory?

new SimGroup(NewPointerGroup);
function SimulateNewPointer(%max)
{
   if (%max $= "")
      NewPointerGroup.deleteObjects();
   else
   {
      for (%i =0; %i < %max; %i++)
      {
         %obj = new SimObject()
         {
            value1 = 123456;
            value2 = 678901;
            value3 = "sjldfljkskjldfjksdfkjlskfljsdkjlfsdkjlfsdfj slfjslkdfs";
         };
         NewPointerGroup.add(%obj);
      }
   }
}

The engine uses a global string table. I can't be sure without checking, but I would bet that table is still holding a reference to your three values. Really the global table is a relic of the past and needs to be replaced.

It is also possible that something else is happening. We would need to investigate further.