tags:

views:

28

answers:

1

I'm trying to work out why memory usage in a basic application I'm writing is excessive. I'm trying to create a dynamic MVC sitemap with about 25000 nodes and populating it from a database table using the entity framework (though this detail is probably not important)

I have the following code:

foreach (var c in context.Companies) { }

With a breakpoint before this line, webdev.webserver40.exe consumes about 50mb. Afterwards about 250mb. I have tried disposing the context, letting the context fall out of scope; calling GC.Collect() each time, yet I can't seem to recover this memory.

NB I know that memory doesn't have to be, and normally isn't released immediately, I just want to put my mind at ease that there isn't a memory leak here.

Thanks

A: 

Why not fire up one of the commercially available memory profilers (all have free trials) such a MemProfiler, compare 2 snapshots and see where you memory went.

Without seeing your code, it's difficult to say whether you have a memory leak.

Mitch Wheat