ivan_b
Topic Author
Posts: 100
Joined: 22 Jul 2015, 12:57

Debugging memory problems

29 May 2018, 16:42

What would be the best way to debug memory problems?
In the new version of Noesis I have run into some memory problems and most of them I have solved, but the problem is that the process is really time consuming.
For every modification I had to run the app and constantly navigating to the user control that I am "profiling" and keep track if the garbage collector will do something about the memory growth.
It would really help if there was a profiling tool for that.
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Debugging memory problems

29 May 2018, 20:26

We offer a callback in C++ to track all the allocations but we don't expose it in the C# layer because we though it doesn't make sense. I don't know, if you have any suggestion to improve this we are open to suggestions.
 
ivan_b
Topic Author
Posts: 100
Joined: 22 Jul 2015, 12:57

Re: Debugging memory problems

30 May 2018, 09:51

Hi jsantos,

The problem is that I free my resources in the user control (every reference and events) but in some cases it still does not help.
I think that a help would be if after I free all my resources, something tells me if noesis will free the resources that I have used.
It can be a function that uses the UserControla as an argument and traverses all the visual tree.
It would be better if it returns which resources could not be freed.
I don't know if this is possible but it would speed up my debugging.

Another thing that would help whit debugging is to know how noesis internally works.
I don't know how much you can describe but some hints would be nice to have.
One thing that I noticed is that noesis allocates memory to some point and then it stops (I don't know the reason for that) but it helped me for debugging.
It has probably something to do with the offscreen settings but I didn't see anything about this in the documentation.
If there is something about this in the documentation and I have missed it can you post a link :D?
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Debugging memory problems

01 Jun 2018, 22:58

Another thing that would help whit debugging is to know how noesis internally works.
I don't know how much you can describe but some hints would be nice to have.
One thing that I noticed is that noesis allocates memory to some point and then it stops (I don't know the reason for that) but it helped me for debugging.
It has probably something to do with the offscreen settings but I didn't see anything about this in the documentation.
If there is something about this in the documentation and I have missed it can you post a link :D?
We don't allocate memory and then stop doing that. Could this be related to how the garbage collector behaves? in C#, memory allocation grows till some threshold and then the memory is freed and reused. All the big objects in Noesis (like offscreens or internal resources) are allocated once.

This could also be related to delegates. We have an internal deviation from WPF regarding this and the best way to overcome it is manually resetting all the delegates you hook to. This is something we will fix in the future.

You also have the method NoesisView.GetStats that can be useful to get performance counters although I am not sure this is something helpful for your scenario.
 
ivan_b
Topic Author
Posts: 100
Joined: 22 Jul 2015, 12:57

Re: Debugging memory problems

04 Jun 2018, 13:17

Hi jsantos,

About the memory allocation I have explained incorrectly what I meant, but it is not relevant :).
I did unsubscribed from events but maybe I have to check again If I did really unsubscribed and if that is causing the problem.
I think that the NoesisView.GetStats would help but for example, the number of triangles that it returns is always zero, I have the version 2.1.0rc2.
 
User avatar
jsantos
Site Admin
Posts: 3918
Joined: 20 Jan 2012, 17:18
Contact:

Re: Debugging memory problems

05 Jun 2018, 20:49

I think that the NoesisView.GetStats would help but for example, the number of triangles that it returns is always zero, I have the version 2.1.0rc2.
Ops, you are right, this is something we need to fix. Right now, only clients with access to source code can build an instrumented version of noesis.

Who is online

Users browsing this forum: Bing [Bot], DHSven and 21 guests