memory leak in Vehicle.cc
by David Stewart Zink · in Torque Game Engine · 02/06/2002 (12:08 pm) · 4 replies
I checked this out a couple days ago, and it hasn't been fixed yet, and I didn't look closely enough to see how to fix it, but it looks like some sort of memory leak to me, if not just a crashing bug.
==torque/engine/game/vehicles/vehicle.cc==
void Vehicle::unpackUpdate(NetConnection *con, BitStream *stream)
{
...
CollisionTimeout* walk = mTimeoutList;
mTimeoutList = NULL;
while (walk)
{
CollisionTimeout* sFreeTimeoutList ;
CollisionTimeout* next = walk->next;
walk->next = sFreeTimeoutList;
sFreeTimeoutList = walk;
walk = next;
}
}
==========
Note that sFreeTimeoutList is uninitialized, etc.
Hint: actually look at warnings generated when you do release builds.
Other hint: Fix all the stupid signed/unsigned mismatch bugs so that you aren't drowned in warnings you think might be meaningless.
==torque/engine/game/vehicles/vehicle.cc==
void Vehicle::unpackUpdate(NetConnection *con, BitStream *stream)
{
...
CollisionTimeout* walk = mTimeoutList;
mTimeoutList = NULL;
while (walk)
{
CollisionTimeout* sFreeTimeoutList ;
CollisionTimeout* next = walk->next;
walk->next = sFreeTimeoutList;
sFreeTimeoutList = walk;
walk = next;
}
}
==========
Note that sFreeTimeoutList is uninitialized, etc.
Hint: actually look at warnings generated when you do release builds.
Other hint: Fix all the stupid signed/unsigned mismatch bugs so that you aren't drowned in warnings you think might be meaningless.
#2
Maybe Tim can confirm.
02/06/2002 (2:45 pm)
David: fixing that leak could be just as simple as removing that declaration of sFreeTimeoutList; cf. this thead: www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=2969Maybe Tim can confirm.
#3
The "memory manager" crashes reliably for me and looks very dubious, so I was looking at outlying culprits suspiciously.
02/06/2002 (11:56 pm)
Thanks Joel, I thought it might be something like that, but I didn't search widely enough and the automatic declaration discouraged me;)The "memory manager" crashes reliably for me and looks very dubious, so I was looking at outlying culprits suspiciously.
#4
I'll make a pass through the next time I get bored and see if I can fix the warnings without changing the semantics...
02/06/2002 (11:59 pm)
I did want to comment that when I first checked out V12 (some competitor's product;) two or three of the hundreds of signed/unsigned and other type warnings were obviously bugs, so the warnings are potentially more than mere annoyance.I'll make a pass through the next time I get bored and see if I can fix the warnings without changing the semantics...
Torque Owner Tim Gift