Confirmed memory leak ?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Confirmed memory leak ?

Postby forestluo » Mon Aug 15, 2011 5:20 am

I set the leave-world event. Once an entity left the world, I would call NewtonDestroyBody to destroy it in the callback function.
But when I exit the application, the VisualStudio would report memory leaks. At first, I thought it would be my own problem. I did more experiments and found that may be a problem in Newton.

I have confirmed that :
1. If NO leave-world event was defined, no memory leak would be reported.
2. If a leave-world event was defined, the memory leak would be reported.
And the leak count exactly equaled the count of the object which had already left the world.
The entity still in the world would not be counted in the memroy leak.

I thought the NewtonDestroyBody cannot delete the body which is not inside the world.
forestluo
 
Posts: 13
Joined: Mon Aug 15, 2011 5:03 am

Re: Confirmed memory leak ?

Postby Julio Jerez » Mon Aug 15, 2011 10:24 am

there are not memory leaks in any of the Newton functions.

you may forget to release a shape after you create one and use it. that will leave a leak of couse, but that will be becuase of wrong usage.
you can track memory allocation by uncomment const

#ifdef _DEBUG
//#define __TRACK_MEMORY_LEAKS__
#endif

in file dgMemory.h
do not let it on becuse the memory leak tracker consumes lot of memory. That is why is not part of engine.

note:
Of I see you are sayin that if a body leave teh word, they it will generate a memory leak.
That may be the case I have to check it out.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Confirmed memory leak ?

Postby forestluo » Mon Aug 15, 2011 10:13 pm

Hi,

Yes ! That's right !
I mean there would be a memory leak when some entities leave the world.
The leak count is exactly the count of leaving entities.
If all the entities is in the world , no memory leak would be reported.

Forest Luo
forestluo
 
Posts: 13
Joined: Mon Aug 15, 2011 5:03 am

Re: Confirmed memory leak ?

Postby JernejL » Tue Aug 16, 2011 1:11 pm

I think what forestluo is saying is, that when a object leaves the world, reference count is kept at +1 and it never goes to zero to be deleted.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Confirmed memory leak ?

Postby Julio Jerez » Tue Aug 16, 2011 1:46 pm

Yes I undernstand, I will check it out thsi weekend
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron