I’m very frustrated – after getting Instruments Leak finally getting to work with my app, I realize there are plenty of leaks. After playing all 18 levels of my game, there is about 5MB of dead memory. Starting with a memory consumption of about 20MB it runs up to 25MB …
It seems, most if not all of the leaks come from bugs in Unity (or its libraries) itself. I see many GeneralBlock-16 caused by the buggy Physx lib.
But there is more – many of the leaks are GUITexture related. My GUITextures are all of a power of 2, all uncompressed 16bit RGBA, some are of square dimensions, some not (e.g. 512x64).
Some examples:
ShaderLab::Subshader leaks 1kb
GeneralBlock-384:
4 GUITexture::RenderGUIElement(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
3 GUITexture:rawGUITexture(Rectf const, Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
2 FillGuiTextureVBOChunk(Rectf const, Texture*, Rectf const, int, int, int, int, ColorRGBA32)
1 DynamicGLESVBO::GetChunk(unsigned long, unsigned long, unsigned long, DynamicVBO::RenderMode, void**, void**)
GeneralBlock-176:
7 GUILayer::PostRender(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
6 GUITexture::RenderGUIElement(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
5 GUITexture::BuildSheet()
4 Shader::MakeProperties() const
3 ShaderLab::IntShader::MakeProperties() const
2 ShaderLab::PropertySheet::PropertySheet(ShaderLab::PropertySheet const)
1 libstdc++.6.dylib operator new(unsigned long)
GeneralBlock-176:
8 RenderManager::RenderCameras()
7 Camera::RenderCamera(int, Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
6 Camera:oRenderLastLayers(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
5 GUILayer::PostRender(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
4 GUITexture::RenderGUIElement(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
3 GUITexture:rawGUITexture(Rectf const, Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
2 FillGuiTextureVBOChunk(Rectf const, Texture*, Rectf const, int, int, int, int, ColorRGBA32)
1 DynamicGLESVBO::GetChunk(unsigned long, unsigned long, unsigned long, DynamicVBO::RenderMode, void**, void**)
DynamicGLESVBO (80 Bytes):
7 Camera::RenderCamera(int, Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
6 Camera:oRenderLastLayers(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
5 GUILayer::PostRender(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
4 GUITexture::RenderGUIElement(Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
3 GUITexture:rawGUITexture(Rectf const, Shader*, std::basic_string<char, std::char_traits, std::allocator > const)
2 GfxDevice::GetDynamicVBO()
So – what to do? Cancel the whole project, because it’s embarassing to release such a leaking game? Months of useless work?
Any ideas how I could prevent at least the GUITexure leaks?
What is your experience with iPhone Apps, leaks, releasing such apps … ?
Questions and more questions.
Jörg