CGImage related memory leak in SceneKit applicatio

2019-08-16 12:55发布

问题:

I am writing a 3d game using Scene Kit. When I used Leaks profile in Instruments, I find leaks exist. For the first red cross icon, it says 51 new leaks. Also if you see further down the leak checks area, there are grayed out dashed icons which say no new leaks.

To put it in context, I try to recreate a scene after one unit of play is completed and present that using presentScene.... That would crash after 4 or 5 units of play. I was getting memory warnings and hence I used the leaks profile.

I cannot figure out how to resolve this leak as I am only using the SceneKit API and not any Core Foundation API. It will be great if someone has a solution or can provide relevant pointers to fix this leak.