Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

Improved object search in dotMemory

When you explore a memory snapshot, it’s never easy to find the object you need. A typical application operates millions of objects, which means a memory profiler must offer adequate searching capabilities. Before dotMemory 2017.3, object set views provided only basic string search. Now, you can make your search more efficient by creating complex search patterns based on CamelHumps and special symbols.

Wildcard search

As usual, the asterisk (*) wildcard means literally “anything” and can be used in any part of your search pattern. For example, sys.*.data may return System.Windows.Controls.Datagrid, System.Data and System.Windows.Data.Binding.

If you want to search only among namespaces, you can do this by adding a period (.) at the end of the pattern. For example, sys.*.data. will return System.Windows.Data.Binding but not the System.Windows.Controls.Datagrid class:
dotMemory search filter

Search for arrays

If you want to only see arrays in search results, simply use square brackets, []. To find arrays of a specific dimension, use commas inside: for example, str[,,] will return String[,,]. If you omit the closing bracket, search results will contain arrays with the specified dimension and all higher ones: str[,, may return String[,,] as well as String[,,,]:
dotMemory search filter. Arrays

The Instances view has a bonus: here you can search by array size or size range.
dotMemory search filter. Array range

You can exclude arrays from search results by adding !a anywhere in the pattern.

Search for types with generic type arguments

To only search for types with generic type arguments, use angle brackets <>. Similar to array search, commas inside the brackets define the number of arguments.
dotMemory search filter. Generic type arguments

If you add !g anywhere in the pattern, all generic type arguments will be excluded from the search scope.

Download ReSharper Ultimate to get the updated dotMemory and try the new object search yourself!

image description