locked
Tracking down memory references RRS feed

  • Question

  • Hi Folks,

    I've been developing a WPF application for the past two years, and it's become a bit of a memory hog. The reason for this is that the app lets users load large data sets into memory, and after the data gets loaded, I keep it in memory so they can have fast access to it again any time later in the program execution. I'm at the point where the poor scalability of this approach is unacceptable, and I want to make it so that after a user has stopped interacting with the data set, I release all references to it, so it can eventually get garbage collected.

    I changed my code so that I thought it would have this behavior. To test my code, I used GC.Collect at the point when I thought all references were free, but the problem is that the memory is not being reclaimed. I'm guessing this is a bug on my part, but I have a rather large code base at this point, and tracking down the offending reference has become next to impossible.

    My question is this, how can I find all reference paths to an object from objects with root reference in the garbage collector? If I could somehow do this in the debugger just before I release my reference to the object, I might have all the information I need to find my stale reference. I thought the GC class would provide a service like this, but I'm fairly convinced it does not at this point.

    Thanks, Adam Cataldo

    Saturday, March 20, 2010 12:04 AM

Answers

All replies