View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003970 | NoesisGUI | C# SDK | public | 2025-02-17 23:31 | 2025-05-23 10:28 |
| Reporter | KeldorKatarn | Assigned To | sfernandez | ||
| Priority | normal | Severity | major | ||
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.2 | ||||
| Target Version | 3.2.8 | Fixed in Version | 3.2.8 | ||
| Summary | 0003970: Accessing child element in decorator allocates memory every frame | ||||
| Description | My code:
Apparently the Child_get property getter is allocating memory every time it is called. | ||||
| Platform | Any | ||||
|
|
|
|
My guess is that the Child is not referenced in the managed world, only in the native instance of the Decorator. So everytime it is requested in the GetVisualChild, a new proxy is created for that child. Could you store a reference to the Child in your DialogHostDecorator to see if that allocation disappears? Visual _child; |
|
|
No, that does not fix it. The allocation happens in Extend.VisualGetChild, outside of my decorator code. Caching the child does nothing, the allocations still happen. I tried caching by doing
But the allocation happens before this code even gets called. It allocates 1.2 kB in Extend.VisualGetChild() and another 312 B in Extend.VisualChildrenCount(). My code is not allocating, it's the Extend class that calls my code that's doing the allocation. The allocation happens before or after my code gets called. Every frame, despite the caching. |
|
|
I'll have to reproduce it and investigate, because the only thing that comes to my mind, as I mentioned, is the creation of the proxy for the child. There is no other new in that part of the code. |
|
|
I think this might have less to do with the actual decorator but more with callbacks in the signature of methods in the Extend class. private static void UIElementRender(IntPtr cPtr, IntPtr contextType, IntPtr context,
All these callbacks I think allocate for a new delegate every frame I think. This seems to be the issue. At least from what I can see. And this is kind of a big deal because it means you can't override any of these methods without causing a memory leak. This is kind of a big deal because it means I cannot override any of these methods without causing a memory leak. The allocation appears whenever I override any of these callbacks that the Extend class handles. Be it GetVisualChild, OnRender... anything that gets called by these Extend methods that have callbacks. |
|
|
This solves issues described in posts: |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2025-02-17 23:31 | KeldorKatarn | New Issue | |
| 2025-02-17 23:36 | KeldorKatarn | Note Added: 0010366 | |
| 2025-02-17 23:36 | KeldorKatarn | File Added: Memory.jpg | |
| 2025-02-18 18:01 | jsantos | Assigned To | => sfernandez |
| 2025-02-18 18:01 | jsantos | Status | new => assigned |
| 2025-02-18 18:01 | jsantos | Target Version | => 3.2.8 |
| 2025-02-19 11:35 | sfernandez | Note Added: 0010374 | |
| 2025-02-19 11:36 | sfernandez | Note Edited: 0010374 | |
| 2025-02-19 12:16 | KeldorKatarn | Note Added: 0010375 | |
| 2025-02-19 12:20 | KeldorKatarn | Note Edited: 0010375 | |
| 2025-02-19 12:21 | KeldorKatarn | Note Edited: 0010375 | |
| 2025-02-19 12:22 | KeldorKatarn | Note Edited: 0010375 | |
| 2025-02-19 15:54 | sfernandez | Note Added: 0010376 | |
| 2025-04-05 22:35 | KeldorKatarn | Note Added: 0010475 | |
| 2025-04-05 22:36 | KeldorKatarn | Note Edited: 0010475 | |
| 2025-04-05 22:37 | KeldorKatarn | Note Edited: 0010475 | |
| 2025-05-23 10:28 | sfernandez | Status | assigned => resolved |
| 2025-05-23 10:28 | sfernandez | Resolution | open => fixed |
| 2025-05-23 10:28 | sfernandez | Fixed in Version | => 3.2.8 |
| 2025-05-23 10:28 | sfernandez | Note Added: 0010735 |