Author Topic: Mesh memory leak in NGUI 3.7.4  (Read 3924 times)

ded_pasha

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Mesh memory leak in NGUI 3.7.4
« 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
« Last Edit: October 29, 2014, 09:41:10 AM by ded_pasha »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mesh memory leak in NGUI 3.6.4
« Reply #1 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.

ded_pasha

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Mesh memory leak in NGUI 3.6.4
« Reply #2 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Mesh memory leak in NGUI 3.7.4
« Reply #3 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.