I have the next very strange situation and problem:
-
.NET 4.0 application for diagram editing (WPF).
-
Runs ok in my PC: 8GB RAM, 3.0GHz, i7 quad-core.
-
While creating objects (mostly diagram nodes and connectors, plus all the undo/redo information) the TaskManager show, as expected, some memory usage “jumps” (up and down).
-
These mem-usage “jumps” also remains executing AFTER user interaction ended. Maybe this is the GC cleaning/regorganizing memory?
-
To see what is going on, I’ve used the Ants mem profiler, but somewhat it prevents those “jumps” to happen after user interaction.
PROBLEM: It Freezes/Hangs after seconds or minutes of usage in some slow/weak laptos/netbooks of my beta testers (under 2GHz of speed and under 2GB of RAM). I was thinking of a memory leak, but…
EDIT 1: Also, there is the case that the memory usage grows and grows until collapse (only in slow machines).
- In a Windows XP Mode machine (VM in Win 7) with only 512MB of RAM Assigned it works fine without mem-usage “jumps” after user interaction (no GC cleaning?!).
EDIT 2: The problem is worse when the system has some other heavy programs running (like Visual Studio, Office and Web pages open). Not even the first symbol of diagram can be created while the memory usage takes off like a rocket to space (hundreds of MBs consumed in seconds). Anyone with similar experiences? what were they strategies?
So, I really have a big trouble because I cannot reproduce the error, only see these strange behaviour (mem jumps), and the tool supposed to show me what is happening is hiding the problem (like the “observer’s paradox”).
Any ideas on what’s happening and how to solve it?
EDIT 3: This screenshot of the Ants memory profiler shows that the huge consumption of ram (in crescendo) if from unmanaged resources.

But, what can be consuming so much memory, so fast??!!!
This would suggest that you’re likely creating a lot of “garbage” – basically, creating and letting many objects go out of scope quickly, but which take long enough to get into Gen1 or Gen2. This puts a large burden on the GC, which in turn can cause freezes and hangs on many systems.
The reason this profiler (ANTS), specifically, could mask this behavior is that it forces a full GC every time you take a memory snapshot. This would make it look like there is no memory “leak” (as there isn’t), but does not show the total memory pressure on the system.
A tool like PerfView could be used to investigate the GC’s behavior during the runtime of the process. This would help you track the number of GCs that occur, and your application state at that point in time.