OpenGL errors 0x0501 and 0x0505 cocos2d-x, samsung quattro Gl_out_of_memory

Our cocos2dx game heavily uses batchnodes but in some devices like samsung quattro and grand after few sessions of gameplay some SpriteSheets go black. And eventually all the sprite sheets go black. We are using CCTextureAtlas to load our batch nodes.

Following are the logs which we think might be creating problem

04-10 08:43:54.171: D/cocos2d-x debug info(3592): OpenGL error 0x0505 in /Users/jitenagarwal/cocos2d-x-2.2.6/projects/pabAndroid/proj.android/…/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 663 * 04-10 08:48:38.541: D/cocos2d-x debug info(3592): OpenGL error 0x0505 in /Users/jitenagarwal/cocos2d-x-2.2.6/projects/pabAndroid/proj.android/…/…/…/cocos2dx/textures/CCTextureAtlas.cpp mapBuffers 306

We have tried following things but nothing helps

We decreased the size of pngs.

We changed the kDefaultSpriteBatchCapacity 128 in CCSpriteBatchnode.h

https://developer.qualcomm.com/forum/qdevnet-forums/mobile-gaming-graphics-optimization-adreno/26579

http://www.cocos2d-x.org/wiki/Max

The problems happens only on Some devices such as Samsung grand quattro.

Device log when this happens 04-10 08:53:19.651: W/Adreno200-GSL(6804): : ioctl code 0xc00c092f (IOCTL_KGSL_GPMEM_ALLOC) failed: errno 12 Out of memory