Page 1 of 1

Re: cpSpaceReindexShape leaking memory

Posted: Thu Aug 09, 2012 10:43 am
by slembcke
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.

Re: cpSpaceReindexShape leaking memory

Posted: Wed Aug 15, 2012 10:26 am
by slembcke
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.

Re: cpSpaceReindexShape leaking memory

Posted: Wed Aug 15, 2012 10:49 am
by slembcke
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.