: Http://memprofiler.com/download.aspx Description: if you use the "attach to a process" method, you need to first install windbg.
Find memory leaks
One way to find memory leaks is to look at a task that performs a lot of memory allocations and keeps instances in memory, but whose memory shocould be released after the task is finished. examples of such tasks are listed below:
·Showing and closing a form
When creating a form, each control must be allocated, and the instances of the form and controls are kept in memory. When the form closes all used memory shocould be garbage collected.
·Opening and closing a document
In a document-oriented program the user shocould be able to open a document, work with it and then close it without increasing the memory used by the application.
·Retrieving a set of pages using ASP. NET
When retrieving pages using ASP. net, specified temporary instances may be created, but, cannot t for caching, all allocated instances shocould be released after the pages have been retrieved and the session (if any) has ended.
To find memory leaks of a selected task, perform the following steps:
1. Start profiling the application, service, or ASP. NET process using the procedure described under the profile a. Net Process Section.
2. perform the task you suspect are leaking memory (e.g., open a document, work with it, and then close it ).
This will make sure that all static instances are created.
3. Collect a heap snapshot.
4. Repeat the task completed MED under step 2.
5. Collect another heap snapshot.
6. Use the show types drop-down list to select "with new or removed instances" to show types whose set of instances has changed between the two snapshots.
7. select the types page and try to locate a type that has live instances that shoshould have been collected. if no memory leak exists, the instances shown in the types page shoshould only be short-lived instances that have not been garbage collected yet. if a memory leak exists, you should be able to find a type with new instances that shoshould have been garbage collected. for instance, if the task were opening and closing a document and a type representing the document has new instances, Then there probably is a memory leak. if you have types that have disposed instances, it may also be an indication of a memory leak. for more information, see dispose tracker.
8. Double-click on the type that has live instances that shoshould have been collected.
9. InInstancesTable, double-click on one of the new instances (indicated by the symbol
).
10. InRoot pathTable you will get information about why the selected instance was not garbage collected.
For more information on how to locate memory leaks, see the. NET memory profiler tutorials at: http://memprofiler.com/tutorials.