View Issue Details

IDProjectCategoryView StatusLast Update
0003053NoesisGUIUnitypublic2025-05-23 18:02
Reporterstonstad Assigned Tosfernandez  
PrioritynormalSeverityminor 
Status resolvedResolutionfixed 
Product Version3.2.2 
Target Version3.2.8Fixed in Version3.2.8 
Summary0003053: Per Frame Heap Memory Allocation
Description

I'm seeing 0.5KB of per frame allocation in Noesis.Update.

1) 240B per-frame allocation in EventArgs.InvokeHandler (Alloc 1.png).
2) 288B per-frame allocation in EventHandlerStore.RaiseEvent (Alloc 2.png)

Are these known behaviors or something I might have caused on my end?

encl. Alloc 1.png, Alloc 2.png.

Attached Files
Alloc 1.png (116,582 bytes)   
Alloc 1.png (116,582 bytes)   
Alloc 2.png (118,796 bytes)   
Alloc 2.png (118,796 bytes)   
PlatformAny

Activities

jsantos

jsantos

2024-01-31 09:28

manager   ~0009143

This is a known issue with no easy solution. EventArgs in WPF are classes allocated from the heap. We need to pool these objects.

stonstad

stonstad

2024-02-02 00:36

reporter   ~0009155

Good to know! These are the only per-frame allocations that I have. I imagine this is a difficult fix?

jsantos

jsantos

2024-02-02 02:13

manager   ~0009157

Last edited: 2024-02-02 02:13

These specific cases can probably be easily optimized. I will find time to analyze this and I will let you know

stonstad

stonstad

2024-02-08 15:16

reporter   ~0009171

Thank you. I am happy to test to see if the behavior is resolved

stonstad

stonstad

2024-12-12 16:18

reporter   ~0010219

Hello! In 3.2.4, I'm seeing significant per-frame allocations 1.7kb per frame, which is 1MB every ~10 seconds. It is coming from EventHandlerStore.RaiseEvent() (screenshot).

image.png (172,960 bytes)   
image.png (172,960 bytes)   
sfernandez

sfernandez

2025-05-23 18:02

manager   ~0010736

Hello,

We found the source of the issue, the UpdateLayout event raised by the BackgroundEffectBehavior, and it turns out to be very easy to fix for your case scenario.

You can go to the EventArgs.cs code and change the InvokeHandler method for this code:

  internal static void InvokeHandler(Delegate handler, IntPtr sender, IntPtr args) {
    EventHandler handler_ = (EventHandler)handler;
    if (handler_ != null) {
      handler_(Extend.GetProxy(sender, false), EventArgs.Empty);
    }
  }

There is another allocation during the RaiseEvent related to a string being passed from the native library that I also fixed, but that requires changes in the native library too. You'll get them in the upcoming 3.2.8 version we're going to release very soon.

Issue History

Date Modified Username Field Change
2024-01-30 18:47 stonstad New Issue
2024-01-30 18:47 stonstad File Added: Alloc 1.png
2024-01-30 18:47 stonstad File Added: Alloc 2.png
2024-01-31 09:26 jsantos Assigned To => jsantos
2024-01-31 09:26 jsantos Status new => assigned
2024-01-31 09:28 jsantos Note Added: 0009143
2024-01-31 09:28 jsantos Target Version => 3.2.4
2024-02-02 00:36 stonstad Note Added: 0009155
2024-02-02 02:13 jsantos Note Added: 0009157
2024-02-02 02:13 jsantos Note Edited: 0009157
2024-02-08 15:16 stonstad Note Added: 0009171
2024-06-03 17:24 jsantos Target Version 3.2.4 => 3.2.5
2024-10-24 12:22 jsantos Target Version 3.2.5 => 3.2.6
2024-11-22 18:19 jsantos Target Version 3.2.6 => 3.2.7
2024-12-12 16:18 stonstad Note Added: 0010219
2024-12-12 16:18 stonstad File Added: image.png
2024-12-16 11:26 jsantos Assigned To jsantos => sfernandez
2025-01-20 17:42 jsantos Target Version 3.2.7 => 3.2.8
2025-05-23 18:02 sfernandez Status assigned => resolved
2025-05-23 18:02 sfernandez Resolution open => fixed
2025-05-23 18:02 sfernandez Fixed in Version => 3.2.8
2025-05-23 18:02 sfernandez Note Added: 0010736
2025-10-10 13:29 jsantos Category Unity3D => Unity