0

I have an app. When i run it for hours i notice it starts getting big. It gets 4x bigger later then t does in the first hour. Since its running on a server with limited ram space i cant have that. I tried doing memory sampling in .NET but all it told me was my json serialization allocates the most memory. Thats inside a loop so i know its gone every iteration.

How do i find what objects is holding my memory? Forcing the GC to collect does not help. So something appears to be holding memory.

  • see http://stackoverflow.com/questions/399847/net-memory-profiling-tools – Bala R Oct 08 '11 at 16:29
  • It may be growing larger, but it's _virtual_ memory, and the question is whether it _needs_ that memory. It would give up some of that memory if the system needed memory for other processes. The question then becomes, does your app need the memory badly enough to start paging? – John Saunders Oct 08 '11 at 16:36

1 Answers1

4

You could use a memory profiler. ANTS Profiler from RedGate and dotTrace from JetBrains are quite popular. There is also a free CLR Profiler from Microsoft which has different versions for CLR 2.0 and CLR 4.0.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • The profiles didnt help me find this but the problem of the leaking was not calling dispose on objects that needed it. I thought the GC calls it eventually but i was wrong –  Oct 10 '11 at 00:54