Hello Guest

Author Topic: Mesh Leak  (Read 4819 times)

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Mesh Leak
« on: November 21, 2014, 01:22:36 am »
I seem to have a mesh leak in my game. I noticed that memory wasn't being release between scene changes, and after running the memory profiler, it seems that meshes aren't being destroyed.

Take the following example. Running the memory profiler, it shows that there's 34 meshes in the scene at startup. The game plays for a minute, then reloads the same scene via Application.LoadLevel. The memory profiler now shows 69 meshes. This is even after I do Resources.UnloadUnusedAssets. Am I wrong to expect 34 meshes, since I did a scene reload?

Here's a screen shot of the profile after a scene reload. I really don't know what to make of it, other than here's a ton of nameless meshes, with a lot of references, in memory.



I don't know if this is a problem specific to 2D Toolkit, but since 2D Toolkit sprites and textmeshes are the only objects that use meshes, I figured I'd ask here to rule out any possible known issues with the framework. Feel free to tell me to buzz off if this has nothing to do with the framework! But any help in general is appreciated :)
« Last Edit: November 21, 2014, 01:26:23 am by Neeko »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Mesh Leak
« Reply #1 on: November 22, 2014, 10:55:49 am »
That looks like some tilemap stuff? If thats in the editor, thats expected - mesh can leak due to Undo handling nastiness. Should not be an issue at runtime though, none of the undo stuff is in there at runtime...

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: Mesh Leak
« Reply #2 on: November 22, 2014, 01:44:03 pm »
Okay thanks for clarifying. I'm not exactly sure what's going on then.

To be honest, I may be mistaking how the (grossly antiquated version) Mono GC allocates memory (just keeps increasing the heap and never gives it back to the OS while running, and never compacts) with an actual memory leak.