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?
cpSpaceAddPostStepCallback - memory leak?
-
- Posts: 3
- Joined: Mon Aug 23, 2010 7:01 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: cpSpaceAddPostStepCallback - memory leak?
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.
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/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 2
- Joined: Fri Sep 10, 2010 3:02 pm
- Contact:
Re: cpSpaceAddPostStepCallback - memory leak?
How do I fix this? It eats up my memory since I need to call it constantly.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: cpSpaceAddPostStepCallback - memory leak?
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/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 2
- Joined: Fri Sep 10, 2010 3:02 pm
- Contact:
Re: cpSpaceAddPostStepCallback - memory leak?
Thanks for the information and the fixing
Will use the trunk until the release comes out.
Will use the trunk until the release comes out.
-
- Posts: 1
- Joined: Tue Sep 14, 2010 2:11 pm
- Contact:
Re: cpSpaceAddPostStepCallback - memory leak?
Just ran into the leak myself. Thanks for the fix!
Keep up the awesome work!
Keep up the awesome work!
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: cpSpaceAddPostStepCallback - memory leak?
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/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 3 guests