mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
fixed memory leak in proper way
This commit is contained in:
parent
27112c468a
commit
7418fbfbbd
1 changed files with 13 additions and 3 deletions
|
|
@ -214,12 +214,22 @@ Profiler::~Profiler()
|
||||||
void Profiler::reset()
|
void Profiler::reset()
|
||||||
{
|
{
|
||||||
mEnabled = false; // in case we're in a profiler call.
|
mEnabled = false; // in case we're in a profiler call.
|
||||||
while (mProfileList)
|
ProfilerData * head = mProfileList;
|
||||||
|
ProfilerData * curr = head;
|
||||||
|
|
||||||
|
while ( curr )
|
||||||
{
|
{
|
||||||
free(mProfileList);
|
head = curr->mNextProfilerData;
|
||||||
mProfileList = NULL;
|
free( curr );
|
||||||
|
|
||||||
|
if ( head )
|
||||||
|
curr = head;
|
||||||
|
else
|
||||||
|
curr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mProfileList = NULL;
|
||||||
|
|
||||||
for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
|
for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot)
|
||||||
{
|
{
|
||||||
walk->mFirstProfilerData = 0;
|
walk->mFirstProfilerData = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue