cpSpaceAddPostStepCallback - memory leak?

Discuss any Chipmunk bugs here.

cpSpaceAddPostStepCallback - memory leak?

Postby Peter » Mon Aug 23, 2010 7:38 am

I've found that calling cpSpaceAddPostStepCallback consumes memory that seems to be never released, even on cpSpaceFree.

For example, in ChipmunkDemo:
Task Manager shows that at LogoSmash it uses ~8600Kb. After switching to Sensors(which uses PostStep callbacks) and waiting about 10 minutes, you'll notice that program uses much more memory. Back to LogoSmash - it is ~31000Kb instead of ~8600Kb.

So, 21 Mb of memory in 10 minutes - is this a bug or am I missing something?
Peter
 
Posts: 3
Joined: Mon Aug 23, 2010 7:01 am

Re: cpSpaceAddPostStepCallback - memory leak?

Postby slembcke » Mon Aug 23, 2010 8:48 am

Confirmed. That's kind of a nasty one too. I was forgetting to free a hash set that got allocated each frame a post step callback was used.

Good catch. I usually check the demo app for memory leaks before releasing, but I guess I missed that one.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: cpSpaceAddPostStepCallback - memory leak?

Postby paule » Fri Sep 10, 2010 3:04 pm

How do I fix this? It eats up my memory since I need to call it constantly. :(
paule
 
Posts: 2
Joined: Fri Sep 10, 2010 3:02 pm

Re: cpSpaceAddPostStepCallback - memory leak?

Postby slembcke » Fri Sep 10, 2010 3:50 pm

This bug has been fixed in trunk, but it looks like it hasn't made it out into a release yet.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: cpSpaceAddPostStepCallback - memory leak?

Postby paule » Sat Sep 11, 2010 3:27 am

Thanks for the information and the fixing :)

Will use the trunk until the release comes out. ;)
paule
 
Posts: 2
Joined: Fri Sep 10, 2010 3:02 pm

Re: cpSpaceAddPostStepCallback - memory leak?

Postby mlmcgoogan » Tue Sep 14, 2010 2:13 pm

Just ran into the leak myself. Thanks for the fix!

Keep up the awesome work!
mlmcgoogan
 
Posts: 1
Joined: Tue Sep 14, 2010 2:11 pm

Re: cpSpaceAddPostStepCallback - memory leak?

Postby slembcke » Tue Sep 14, 2010 3:28 pm

So I think this leak may have existed since I implemented the post-step callback feature... Not sure how it went so long without being noticed.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests