spine-spritekit icon indicating copy to clipboard operation
spine-spritekit copied to clipboard

Memory leak issue

Open danamo opened this issue 9 years ago • 1 comments

After getting some crashes I verified the demo code using Apple's instruments tool to detect leaks and it keeps showing a leak on:

extention.c - line 43 :

void* _malloc (size_t size, const char* file, int line) { if(debugMallocFunc) return debugMallocFunc(size, file, line);

return mallocFunc(size); }

Any idea how to solve this issue? it basically leaks every time I upload a skeleton which eventually causes the app to run out of memory and crash... Thanks for your help!

screen shot 2015-06-10 at 12 34 04 pm screen shot 2015-06-10 at 12 33 44 pm screen shot 2015-06-10 at 12 33 26 pm

danamo avatar Jun 10 '15 16:06 danamo

I found the issue. You forgot to clear the AnimationStateData. I added it to the spine_dispose method in spine_adapt.m:

int spine_dispose( struct spinecontext *ctx) { spAnimationStateData_dispose(ctx->state->data); spAnimationState_dispose(ctx->state); spSkeleton_dispose(ctx->skeleton); spSkeletonData_dispose(ctx->skeletonData); spSkeletonJson_dispose(ctx->json); spAtlas_dispose(ctx->atlas); return 0; }

danamo avatar Jun 11 '15 18:06 danamo