cpSpaceReindexShape leaking memory

Discuss any Chipmunk bugs here.

Re: cpSpaceReindexShape leaking memory

Postby slembcke » Thu Aug 09, 2012 10:43 am

Hmm. Not sure why that would cause a memory leak off the top of my head. I'm on vacation this week, but left myself a TODO note to check it out when I get back.
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: cpSpaceReindexShape leaking memory

Postby slembcke » Wed Aug 15, 2012 10:26 am

Aha. So you are correct. So there are two trees, one for static shapes and one for dynamic ones. The trees are supposed to be sharing the dynamic trees pool of internal data structures, but it looks like when reindexing static objects it's creating a second unshared pool for the static tree. Looks like it shouldn't be too hard to fix.

The buffers are tracked, so at least it would free that memory when the space is freed. For a long running game that reindexed a lot of objects, it could waste a few megabytes of RAM though.
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: cpSpaceReindexShape leaking memory

Postby slembcke » Wed Aug 15, 2012 10:49 am

Hah. So even worse than I thought, but very easy to fix. The fix is in the GitHub repository.

It was adding objects from the dynamic tree's pool to the static tree's pool and then NEVER USING THEM AGAIN. Oops. Hehe.
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 1 guest