spine-spritekit
spine-spritekit copied to clipboard
Memory leak issue
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!
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; }