Memory LEAK when using CCTextureCache::sharedTextureCache->addImageAsync(...)

Victor Komarov wrote:

I can confirm that there’s a bug in TextureCache loadImageAsync method, which will cause crashes, if your application is heavy on graphics and reloads resources between scenes. Android is not affected. I was really impressed seeing iPad2 crashing while htc wildfire worked properly.
>
Moving
CCThread thread; thread.createAutoreleasePool();
inside while loop in loadImage function in CCTextureCache.cpp fixes that issue, at least I can see no leaks in xcode tool and application works as expected.
>
Thanks to ruler zhang :slight_smile:

No at all~
My partner solved it actually, why not commit the code to github? Maybe it can help others.

A bug (http://www.cocos2d-x.org/issues/1087) was created 8 month ago, to add some certainty here’s some graphs, made for cocos2d-x ver. 2.1

  1. TextureCache test without fix, being run several times repeatedly

  2. TextureCache test with fix, suggested by Ruler Zhang

Now I’m trying to add a pull request…