CCTextureCache::sharedTextureCache()->removeUnusedTextures() causes crash on Android but not iOS?

I have an app to deploy on iOS and Android. I’m currently having trouble with clearing the texture cache. I’m frequently adding and removing new large images to the scene, and to manage the images I’m calling

CCTextureCache::sharedTextureCache()->removeUnusedTextures();

after a certain number of images have been created and removed, to keep memory at reasonable levels.

The problem is that sometimes on Android this will cause the app to completely stop responding to user input and to wreck the scheduled ::tick(ccTime dt) selector. Everything just freezes. There is one use case where it almost always happens, but it might happen randomly at other times too, and it is always caused by calling removeUnusedTextures()

Why does this happen on Android, but not iOS? How can I solve this problem?

any solution? I also hit the same issue on android but not on ios
here is my NDK stack dump
Stack frame #00 pc 0017965e /system/framework/core.odex
Stack frame #01 pc 00cfd614 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::Ref::release()+416): Routine cocos2d::Ref::release() at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./base/CCRef.cpp:133
Stack frame #02 pc 00d65b38 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::VolatileTexture::~VolatileTexture()+60): Routine ~VolatileTexture at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./renderer/CCTextureCache.cpp:595
Stack frame #03 pc 00d66100 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::VolatileTextureMgr::removeTexture(cocos2d::Texture2D*)+196): Routine cocos2d::VolatileTextureMgr::removeTexture(cocos2d::Texture2D*) at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./renderer/CCTextureCache.cpp:702
Stack frame #04 pc 00d5a898 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::Texture2D::~Texture2D()+52): Routine ~Texture2D at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./renderer/CCTexture2D.cpp:444
Stack frame #05 pc 00d5a848 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::Texture2D::~Texture2D()+24): Routine ~Texture2D at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./renderer/CCTexture2D.cpp:442
Stack frame #06 pc 00cfd614 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::Ref::release()+416): Routine cocos2d::Ref::release() at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./base/CCRef.cpp:133
Stack frame #07 pc 00d64f54 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (cocos2d::TextureCache::removeUnusedTextures()+172): Routine cocos2d::TextureCache::removeUnusedTextures() at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/./renderer/CCTextureCache.cpp:462
Stack frame #08 pc 006c8dcc /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so (lua_cocos2dx_TextureCache_removeUnusedTextures(lua_State*)+256): Routine lua_cocos2dx_TextureCache_removeUnusedTextures(lua_State*) at /Users/trevor/cocos2dxquickws/Casino/frameworks/runtime-src/proj.android_no_anysdk/…/…/cocos2d-x/cocos/scripting/lua-bindings/proj.android/…/auto/lua_cocos2dx_auto.cpp:64092
Stack frame #09 pc 00abecc0 /data/app-lib/com.vxinyou.casino-8/libcocos2dlua.so: Routine lj_BC_FUNCC at fadd_n.c:?