View Issue Details

IDProjectCategoryView StatusLast Update
0001596NoesisGUIC# SDKpublic2021-07-27 20:05
Reporterstonstad Assigned Tojsantos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.2.5 
Target Version3.1Fixed in Version3.1.0 
Summary0001596: Unity 2019.2.x OnGUI GC Allocation in NoesisView.OnGUI
DescriptionThe Unity MonoBehavior function OnGUI has a 0.7 kb per-frame gc allocation. Unity does not intend to fix this, as OnGUI is deprecated, per this thread: https://forum.unity.com/threads/gc-coll ... ui.642229/

NoesisView.cs uses OnGUI as follows:
 void OnGUI()
    {
        if (_uiView != null)
        {
            UnityEngine.GUI.depth = -(int)_myCamera.depth;
            ProcessEvent(UnityEngine.Event.current, _enableKeyboard, _enableMouse, _emulateTouch);
        }
    }

I can confirm the following:
1. OnGUI leaks memory without the internal Noesis logic.
2. Commenting out OnGUI completely removes a 0.7 kb per frame allocation.

To eliminate this allocation, is there a different location Noesis logic may be moved to?

Allocation screenshot: https://i.imgur.com/AAfTwRS.png


TagsNo tags attached.
PlatformAny

Relationships

has duplicate 0001682 resolvedjsantos OnGUI GC Allocations 

Activities

jsantos

jsantos

2021-06-23 02:23

manager   ~0007312

Last edited: 2021-06-23 02:24

It seems I found a way to disable GC Allocs in our View. Just by adding the following function, all spikes disappear.

    void Start()
    {
        // https://forum.unity.com/threads/gc-collect-in-guiutility-begingui.642229/
        // Avoid OnGUI GC Allocations
        useGUILayout = false;
    }

I feel silly because this function was removed in 0001433. This time I added a better comment to avoid this mistake again.

Issue History

Date Modified Username Field Change
2019-12-06 17:18 stonstad New Issue
2019-12-12 14:36 stonstad Summary Unity 2019.2.x OnGUI Memory Leak NoesisView.OnGUI => Unity 2019.2.x OnGUI GC Allocation in NoesisView.OnGUI
2021-06-23 01:34 jsantos Assigned To => jsantos
2021-06-23 01:34 jsantos Status new => assigned
2021-06-23 01:34 jsantos Target Version => 3.1
2021-06-23 02:23 jsantos Note Added: 0007312
2021-06-23 02:23 jsantos Note Edited: 0007312
2021-06-23 02:24 jsantos Note Edited: 0007312
2021-06-23 02:24 jsantos Note Edited: 0007312
2021-06-23 02:24 jsantos Note Edited: 0007312
2021-06-23 02:26 jsantos Status assigned => resolved
2021-06-23 02:26 jsantos Resolution open => fixed
2021-06-23 02:26 jsantos Fixed in Version => 3.1
2021-06-23 17:27 jsantos Relationship added has duplicate 0001682
2021-07-27 20:05 jsantos Fixed in Version 3.1 => 3.1.0