Image.fillAmount and memory allocation

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:
2159231--142693--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.

1 Like

Still present on 5.2.2 - any fix?

I also have these ruining my VR framerate attempts too.

No bug has been filed so no no fix.

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…

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.

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

UI.Image.fillAmount setter generates unnecessary garbage when setting any value since it calls Single.Equals() from SetPropertyUtility.SetStruct() 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.

Still present in 5.4.3p3, ? How is this not changed yet?