Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Image.fillAmount and memory allocation

Discussion in 'UGUI & TextMesh Pro' started by lemus01, Jun 14, 2015.

  1. lemus01

    lemus01

    Joined:
    Feb 3, 2015
    Posts:
    9
    Hello All,
    While profiling my app I found out that changing Image.fillAmount property allocates 20B of memory.
    It is not much but in my case when I have timer made with Image.fillAmount, this memory is allocated every frame.

    Screenshot:
    2015-06-14 20_15_54-.png

    It is of course handled by GarbageCollector at some point but we all know how GC can decrease framerate when collecting garbage. Especially on mobile.

    One of my goals is to use pooling and not give GC reason to work. I am close to achieve that but above problem exists.

    Btw, do maybe anyone know what is this "NetworkIdentity.UNetStaticUpdate" and "GetMainGameViewRenderRect"?

    Thanks.
     
    hippocoder likes this.
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Still present on 5.2.2 - any fix?

    I also have these ruining my VR framerate attempts too.
     
  3. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    No bug has been filed so no no fix.
     
  4. NeilW

    NeilW

    Joined:
    May 29, 2014
    Posts:
    40
    Sorry for the thread hi-jack but the standard 'file a bug' response really gets my goat because our game has become all but unplayable since upgrading to unity 5. When I did take the time to create a reduced test case for the multiple megabyte allocations and multiple second stalls we see when presenting simple relatively simple bits of UI it was resolved as 'by design' - I'm not completely naive and I apprectiate that things do cost CPU time and memory but there are some serious issues with the UI in 5.x - I'm all for trying to get to the bottom of them together but it's not helpful to effectively be told that opening a UI *should* take multiple seconds and allocate about 5 megs - that its just ridiculous.

    So good luck with that bug report for allocating 20 bytes...
     
  5. phil-Unity

    phil-Unity

    Unity UI Lead Developer Unity Technologies

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    PM me some of the bug numbers (if you still have them) and i'll take another look to see why they were closed by design and maybe be able to give you more details.
     
  6. Ironmax

    Ironmax

    Joined:
    May 12, 2015
    Posts:
    890
    I can confirm that fillAmount does generate allocation, its not a bug. I guess it uses some type of array.

    There is nothing to report, just open Unity (if not a problem) and change fillAmount in update or lateupdate and it will allocate memory. Even doing fillAmount = 0 will allocate
     
  7. tikhiy

    tikhiy

    Joined:
    Aug 14, 2012
    Posts:
    2
    UI.Image.fillAmount setter generates unnecessary garbage when setting any value since it calls Single.Equals() from SetPropertyUtility.SetStruct<T>() method. So making any kind of progress bars using Image with constantly modified fillAmount is producing a lot of garbage. I believe this can be fixed easily and will help a lot to avoid GC spikes on mobile platforms.
     
  8. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,418
    Still present in 5.4.3p3, ? How is this not changed yet?