Joel VDV
Topic Author
Posts: 7
Joined: 14 May 2025, 07:59

Endlessly increasing memory allocations

16 Feb 2026, 08:25

I'm finding a steadily increasing amount of allocated memory by Noesis (3.2.7) between multiple matches in my Unity app for Meta Quest (Android).
There's several world space UIs, but they (the NoesisWorldUi's) along with the NoesisView are all destroyed at the end of each program state.

That is, they are created for the main menu, then destroyed when going into a match. They are then created within a match, and destroyed at the end of the match.

In one series of tests, after swapping between some menu scenes, the memory had reached this point by the start of the first match:
Accumulated: 265047320
Current: 21140344
Allocs: 983074

By the start of the second:
Accumulated: 332761976
Current: 21948936
Allocs: 1448473

By the start of the third:
Accumulated: 399827368
Current: 22387264
Allocs: 1910425

These values have been sampled with
Noesis.Memory.Accumulated
Noesis.Memory.Current
Noesis.Memory.Allocs

There's very little going on beyond the basic Noesis functionality here. Loading of xaml's/etc. is done by Noesis within the provided Unity components (NoesisWorldUi, NoesisView), so I can't intuitively see any opportunity for me to be doing anything differently.

I've also subscribed to logs. I'm not sure what to expect, but something I have noticed is that xaml's are loaded several times over. There's no sign of any "unload" logs.

Is there any guidance on how to go about debugging this problem space, or documentation regarding cleaning up UI's that I am missing (rather than just destroying their game objects?).

Thank you.
 
User avatar
ttermeer-reboundcg
Posts: 31
Joined: 13 Sep 2019, 11:10
Contact:

Re: Endlessly increasing memory allocations

16 Feb 2026, 12:35

You can use Unity memory profiler to check if your UI classes are still in memory and then hunt down any references.
Common issue is reference held by events.
 
User avatar
jsantos
Site Admin
Posts: 4823
Joined: 20 Jan 2012, 17:18
Contact:

Re: Endlessly increasing memory allocations

16 Feb 2026, 13:02

Also make sure to update to 3.2.10 (or wait a bit for 3.2.11), we fixed a few things regarding memory usage in C# bindings.
 
Joel VDV
Topic Author
Posts: 7
Joined: 14 May 2025, 07:59

Re: Endlessly increasing memory allocations

17 Feb 2026, 09:05

Thanks both for the quick responses already.

I've done some extensive memory profiling today.
I've got no NoesisWorldUis or NoesisViews hanging around beyond their expended lifetime.

I can't find anything to suggest the game code is holding onto noesis references.

I can see an increasing amount of ExtendInfo within the Extend classes static dictionary.
Allocs went up nearly 1 million between these two memory snapshots.

I'll need to try a version update, but if there is any known issue or workaround that'd be great.
Or, specific keywords for me to look into in the memory profiler that I may have missed?
Attachments
Unity_3xJJj4TgTQ.png
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Endlessly increasing memory allocations

17 Feb 2026, 11:55

The main source of memory leaks in C# is event handlers. If a control subscribes to an event and the the handler references the control itself, then the delegate keeps a reference to the control and then it will never be released. You should use a weak event registration to avoid this:
    public MainWindow()
    {
        // Break circular reference using a WeakReference as intermediary
        WeakReference weak = new WeakReference(this);
        this.MouseDown += (s, e) => { ((MainWindow)weak.Target)?.OnMouseDown(s, e); };
        this.MouseUp += (s, e) => { ((MainWindow)weak.Target)?.OnMouseUp(s, e); };
        this.MouseMove += (s, e) => { ((MainWindow)weak.Target)?.OnMouseMove(s, e); };

        this.InitializeComponent();
    }
Could you check that?
 
Joel VDV
Topic Author
Posts: 7
Joined: 14 May 2025, 07:59

Re: Endlessly increasing memory allocations

18 Feb 2026, 04:44

We really don't have much going on in the control level other than the basic noesis boilerplate.
I searched through, but couldn't find anything that fits this criteria.

Most of our dynamic features are bound to ReactiveCommand or BindableReactiveProperty from the R3 library (https://github.com/c9s/r3)
These are disposed of, and I can't find any managed references of our view models remaining.

I'm going to try updating Noesis now, to see if there's any improvements.

Who is online

Users browsing this forum: Bing [Bot] and 4 guests