Memory Leaks - iOS/OSX

In my attempt to track down crashes which look like they are potentially due to memory issues I have spent the weekend looking at leaks.

Here is the list of leaks after exiting to main after the director->end

As you can see there doesn’t appear to be any Nodes/Sprites etc… and there is a lot of ProgramState

AppDelegate app;
auto ret = Application::getInstance()->run();
moonring::release();
#if CC_REF_LEAK_DETECTION
Ref::printLeaks();
#endif
return ret;

And I modified printLeaks to printf and not Log because you can’t log after the Director has been ended…

**[memory] WARNING: 299 Ref objects still active in memory.**
**[memory] LEAK: Ref object 'N7cocos2d7backend9DeviceMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend17RenderPipelineMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend10TextureMTLE' still active with reference count 206.**
**[memory] LEAK: Ref object 'N7cocos2d7backend10TextureMTLE' still active with reference count 8.**
**[memory] LEAK: Ref object 'N7cocos2d7backend10ProgramMTLE' still active with reference count 10.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 3.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 2.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend10ProgramMTLE' still active with reference count 216.**
**[memory] LEAK: Ref object 'N7cocos2d7backend15ShaderModuleMTLE' still active with reference count 2.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d12FontFreeTypeE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d9FontAtlasE' still active with reference count 7.**
**[memory] LEAK: Ref object 'N7cocos2d7network11HttpRequestE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend10TextureMTLE' still active with reference count 8.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend12ProgramStateE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d9Texture2DE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7backend10TextureMTLE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d8DirectorE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d13ConfigurationE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d7ConsoleE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d9SchedulerE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d13ActionManagerE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d15EventDispatcherE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d11EventCustomE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d12TextureCacheE' still active with reference count 1.**
**[memory] LEAK: Ref object 'N7cocos2d19GroupCommandManagerE' still active with reference count 1.**

I have a question about the ProgramStates. I am attaching them to a node like this…

node->setProgramState(programState->clone());

setProgramState will retain, and clone retains the program inside the program state… should I be doing an extra release somewhere…?

Yes, you should release that cloned program, after being set in that node
auto prog = programState->clone();
node->setProgramState(prog);
prog->release();