Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ded_pasha on October 28, 2014, 03:22:03 AM

Title: Mesh memory leak in NGUI 3.7.4
Post by: ded_pasha on October 28, 2014, 03:22:03 AM
Hi!

I have Mesh memory leak in my project(profiler show - don't saved in NGUI), it happens when I add new windgets to scene. And drawcalls don't trim mesh.
I have read this post http://www.tasharen.com/forum/index.php?topic=6210.0, but I have this code in NGUI 3.7.4 and it doesn't help.
    
Any help is appreciated
Title: Re: Mesh memory leak in NGUI 3.6.4
Post by: ArenMook on October 29, 2014, 05:11:55 AM
3.6.4 is quite out of date, but that post you linked is even older, and the code mentioned within is already a part of NGUI. Mesh not being trimmed? If you mean mesh buffers being bigger than needed, that's an optimization done to reduce GC allocation.
Title: Re: Mesh memory leak in NGUI 3.6.4
Post by: ded_pasha on October 29, 2014, 06:58:02 AM
Hi!

Sorry, I'm mistake about version of NGUI, my problem on 3.7.4. When it's not trim(load new GUI: windgets...), Mesh take huge memory. After load/unload widgets, mesh doesn't unload memory.

So, my test show when forced trim memory is ok, if not forced trim mesh take more, and more memory.
Title: Re: Mesh memory leak in NGUI 3.7.4
Post by: ArenMook on October 30, 2014, 11:28:09 AM
Meshes are tied to draw calls, not widgets -- and they are reused. If you want to clear everything, you can call UIDrawCall.ReleaseInactive() function after disabling/destroying the UI. Note that all destroy calls are delayed in Unity, so you need to wait a frame.