Search Unity

Memory Leak in Selection.GetFiltered() with SelectionMode.DeepAssets ?

Discussion in 'Editor & General Support' started by Tinus, May 5, 2011.

  1. Tinus

    Tinus

    Joined:
    Apr 6, 2009
    Posts:
    437
    I've been tracking down a memory leak that was killing the editor while parsing through large selections of files, and I ended up at the following line of code:

    Code (csharp):
    1. Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets | SelectionMode.DeepAssets);
    After playing around with it, it seems SelectionMode.DeepAssets is the culprit. Even for relatively small selections this can add whole megabytes of memory each time it is called, and you don't ever get that memory back. Troubling, since I'm building an easy to use batch-processor. ;)

    Is there something I'm forgetting? I tried some GC.Collect calls, but no dice. Time for a bug report?
     
  2. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Sure. I recommend to make some robot and sent that report at least 5x a day. Maybe after month or two they will inform you about putting this between issues :)
     
  3. Tinus

    Tinus

    Joined:
    Apr 6, 2009
    Posts:
    437
    Created the email bot, let's hope for the best.
     
  4. tarragon

    tarragon

    Joined:
    Dec 28, 2010
    Posts:
    38
    Good job.

    I think a full page ad with the bug report in NY Times would do a better job, but this is cheaper.