Garbage collected programs, in theory, never leak memory. In practice that isn\'t the case, which is probably why you\'re using Memory Validator.<\/p>\n\r
<\/p>\n\r
If references to objects are not reset to null<\/span> the garbage collector will not collect the object, even if it will never be used again by the program. Such conditions are hard to detect even with tools like Snapshots<\/a> and Heap Dumps<\/a>.<\/p>\n\r <\/p>\n\r To aid in this task we\'ve created a dedicated .Net leak analysis query facility where you can use predefined queries or design your own query. <\/p>\n\r <\/p>\n\r Each query is formed from five factors and the display of the results allows for a range of filtering options.<\/p>\n\r <\/p>\n\r Click a part of the image below to jump straight to the help for that area.<\/p>\n\r <\/p>\n\r <\/span> <\/p>\n\r <\/p>\n\r <\/p>\n\r Data from each query is displayed in the tree control. <\/p>\n\r <\/p>\n\r Each query is prefixed with a line that describes the query that was run.<\/p>\n\r <\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r The query results are displayed after the description. <\/p>\n\r <\/p>\n\r Each line has an icon<\/a> at the left, indicating its type, and has an explanatory tooltip:<\/p>\n\r <\/p>\n\r The text on each line indicates:<\/p>\n\r <\/p>\n\r •<\/span>datatype (if known) <\/span><\/p> •<\/span>size<\/p> •<\/span>allocation address\/handle value <\/p> •<\/span>source file and line number (if available) where the allocation occurred<\/p> •<\/span>optional event sequence id<\/a> at the beginning of the line<\/p> <\/p>\n\r There are two types of callstack representation. <\/p>\n\r <\/p>\n\r The first callstack representation is that of an object that has been allocated on a callstack that has never had any objects allocated on it that have been garbage collected.<\/p>\n\r <\/p>\n\r <\/p>\n\r <\/p>\n\r The second callstack representation is that of an object that has been allocated on a callstack that has had objects allocated on it garbage collected.<\/p>\n\r <\/p>\n\r <\/p>\n\r <\/p>\n\r This colouring is controlled by the Enhanced callstack colouring<\/span> option on the Callstack<\/a> settings of the settings dialog.<\/p>\n\r <\/p>\n\r <\/p>\n\r <\/p>\n\r Before displaying the data from a query the data needs to meet the criteria specified by the display style. This is a simple filter based on the availability of source code, and where that source code is on the callstack. The reason for this is that allocations (causing memory leaks) in your source code are fixable, whereas allocations in 3rd party code, or allocations that don\'t have source code are not fixable because you don\'t have access to the source code. This doesn\'t mean you should ignore such allocations as they may be caused by a side effect of one of your allocations or a reference from an object you control, but the ability to filter the data this way can greatly simplify the scope of the query results you are examining and lead to greater insight. In addition to the display style, data is also displayed according to a callstack group critieria: display all callstacks, or group similar callstacks together.<\/p>\n\r <\/p>\n\r Both of these styles can be edited using the .Net Leak Analysis display settings<\/a> dialog.<\/p>\n\r <\/p>\n\r •<\/span>Display...<\/span> displays the .Net Leak Analysis display settings<\/a> dialog <\/span><\/p> <\/span><\/p>\n\r <\/p>\n\r <\/p>\n\r A query is defined by five criteria which need to be matched to put each object into the query results.<\/p>\n\r <\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r To use a criteria in a query enable the appropriate check box.<\/p>\n\r <\/p>\n\r <\/p>\n\r •<\/span>Increasing<\/span> object count increases each generation <\/span><\/p> •<\/span>Increasing or stable<\/span> object count increases or remains stable each generation <\/span><\/p> •<\/span>Decreasing<\/span> object count decreases each generation <\/span><\/p> •<\/span>Decreasing or stable<\/span> object count decreases or remains stable each generation <\/span><\/p> <\/p>\n\r <\/span><\/p>\n\r •<\/span>No Churn<\/span> There is no object churn <\/span><\/p> •<\/span>N<\/span> Object has no object churn for N generations <\/span><\/p> <\/p>\n\r [where N is list of numbers representing each generation except the current generation]<\/p>\n\r <\/p>\n\r <\/p>\n\r •<\/span>Generation > 0<\/span> Any object in a generation greater than 0 <\/span><\/p> •<\/span>N<\/span> Object generation is greater than the specified generation <\/span><\/p> <\/p>\n\r [where N is list of numbers representing each generation except the current generation]<\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r •<\/span>Age > 0<\/span> Any object older than 0 <\/span><\/p> •<\/span>N<\/span> Object age is greater than the specified age <\/span><\/p> <\/p>\n\r [where N is list of numbers representing each generation except the current generation]<\/p>\n\r <\/p>\n\r <\/p>\n\r •<\/span>No activity<\/span> No object activity <\/span><\/p> •<\/span>N<\/span> Object has no activity for N generations <\/span><\/p> <\/p>\n\r [where N is list of numbers representing each generation except the current generation]<\/p>\n\r <\/p>\n\r <\/p>\n\r •<\/span>Collected callstack<\/span> Object allocated on a callstack that previous deallocated objects were allocated on <\/span><\/p> •<\/span>Not collected callstack<\/span> Object allocated on a callstack that no deallocated objects were allocated on <\/span><\/p> •<\/span>Collected (recent GC)<\/span> Object of a type that has been collected in a recent GC <\/span><\/p> •<\/span>Not collected (recent GC)<\/span> Object of a type that has not been collected in a recent GC <\/span><\/p> •<\/span>Collected (any GC)<\/span> Object of a type that has been collected in any GC <\/span><\/p> •<\/span>Not collected (any GC)<\/span> Object of a type that has been collected in any GC <\/span><\/p> <\/p>\n\r <\/p>\n\r <\/p>\n\r Setting up queries can be time consuming and tedious. To help with this there are some built-in predefined queries. <\/p>\n\r <\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r •<\/span>Predefined queries<\/span> select a query to use. The controls that define a query will be updated to match the selected query definition. <\/span><\/p> <\/span><\/p>\n\r The default predefined queries are:<\/p>\n\r <\/span><\/p>\n\r o<\/span>Rising count, no churn<\/p> o<\/span>Rising count, no churn, previous allocations collected on same callstack<\/p> o<\/span>Rising count, no churn, previous allocations not collected on same callstack<\/p> o<\/span>Rising or stable count, no activity<\/p> o<\/span>Rising or stable count, no activity, previous allocations collected on same callstack<\/p> o<\/span>Rising or stable count, no activity, previous allocations not collected on same callstack<\/p> o<\/span>No churn for 1 generation and no activity for 1 generation<\/p> o<\/span>No churn for 2 generations and no activity for 2 generations<\/p> o<\/span>No churn for 3 generations and no activity for 3 generations<\/p> o<\/span>No activity for 3 generations<\/p> o<\/span>Show objects collected by GC<\/p> o<\/span>Show objects collected by any GC<\/p> o<\/span>Show objects not collected by any GC<\/p> o<\/span>Show objects not collected by any GC where object count is increasing<\/p> o<\/span>Show objects not collected by 3 GCs where object count is increasing<\/p> o<\/span>Show objects not collected by any GC where no object activity<\/p> o<\/span>Show objects not collected by 3 GCs where no object activity<\/p> <\/p>\n\r •<\/span>Add query<\/span> a new query is formed using the selection in the six combo boxes described in the Defining a Query<\/a> section. The query is added to the list of predefined queries. <\/span><\/p> <\/span><\/p>\n\r •<\/span>Reset<\/span> reset the list of predefined queries to the default predefined queries. All custom predefined queries will be lost. <\/span><\/p> <\/span><\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r The controls at the top left define how queries are run and managed.<\/p>\n\r <\/p>\n\r •<\/span>Run query<\/span> all objects in the current generation are compared to the current query definition. If they match the query they are displayed according to the display style<\/a> rules. <\/span><\/p> <\/span><\/p>\n\r •<\/span>Add query<\/span> a new query is formed using the selection in the six combo boxes. The query is added to the list of predefined queries.<\/p> <\/span><\/p>\n\r •<\/span>Clear<\/span> all query results are removed <\/span><\/p> <\/span><\/p>\n\r •<\/span>Auto clear<\/span> if selected all previous query results will be removed each time a new query is run <\/span><\/p> <\/span><\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r The following popup menu provides options for filtering and examining data in more detail.<\/p>\n\r <\/span><\/p>\n\r <\/p>\n\r <\/p>\n\r <\/p>\n\r <\/p>\n\r The following options are only active for .Net object types. They are disabled for native object types.<\/p>\n\r <\/p>\n\r •<\/span>Go to Heap Dump <\/span> Find the heap dump entries for the selected objects. <\/span><\/p> <\/span><\/p>\n\r •<\/span>Paths to Root <\/span> For the selected objects display all the paths from the object to the most recent heap dump roots with the Paths to Root<\/a> dialog. <\/span><\/p><\/a>Displaying Data<\/span><\/h1>\n\r
<\/h1>\n\r
<\/span><\/h1>\n\r
<\/a>Display Style<\/span><\/h1>\n\r
\n\r <\/p>\n\r<\/a>Defining a Query<\/span><\/h1>\n\r
Object count<\/span><\/h2>\n\r
Object churn<\/span><\/h2>\n\r
Object generation<\/span><\/h2>\n\r
Object age<\/span><\/h2>\n\r
Object activity<\/span><\/h2>\n\r
Garbage collected<\/span><\/h2>\n\r
<\/a>Predefined Queries<\/span><\/h1>\n\r
<\/a>Running Queries<\/span><\/h1>\n\r
<\/span><\/h1>\n\r
<\/span><\/h1>\n\r
<\/a>Leak Analysis view popup menu<\/span><\/h1>\n\r
<\/a>Menu option: Go to Heap Dump, Paths to Root, Paths from Root<\/span><\/h1>\n\r