First I must say that I love your product! It's a must-have tool.
Since I've used it for so long now, I've "developed" a technique that helps me spot elusive leaks, which I'd like to share:
My first steps are somewhat trivial:
- Obtain 2 snapshots from a similiar state in the system. The best way is to run a leaky scenario once; take a snapshot; run it again; take a 2nd snapshot.
- Pick a type which has a large instance delta, and go to the type details page for it.
- Try to locate instances which should've been removed, and investigate their root paths & allocation call stacks.
My "breakthrough" was when I thought about what makes leaky instances differ from the normal ones:
- They usually have a unique allocation stack.
- They must have new live instances.
- They must have live instances which are not new. This is because the 1st snapshot was taken after the same leaky scenario, so instances must have leaked in the 1st snapshot and still be alive in the 2nd, which makes them "not new", or "old".
- Go to the allocation stacks tab.
- Put the cursor in the Call stack text box.
- Observe the details in the bottom: you should look for allocation stacks with at least 1 New live instance, and with more Live instances than New live instances.
- If the allocation stack satisfies the rule in step 3, then your leaky instances were allocated with this allocation stack. From here you can press "Select instances" and investigate the highlighted instances, or press "Show root paths for stack" and see why those instances where not collected.
- If the allocation stack does not satisfy the rule, press the UP key in the keyboard to cycle to the next allocation stack.
- Repeat from step 3.
Live instances: 1,234; New live instances: 1,234;
Not a leak. All the instances are new, so instances with this allocation stack from the 1st snapshot did not survive in the 2nd snapshot.
Live instances: 500; New live instances: 0;
Not a leak. All the instances are old, so the leak couldn't have originated from this allocation stack.
Live instances: 8; New live instances: 2;
Probably a leak! There are survivors from the 1st snapshot, as well as new instances from the 2nd snapshot, so this is a great allocation stack candidate for a leak.
I hope I was clear enough, and that my technique will help others in their quest for leak-less applications.
I also hope that SciTech will integrate some sort of functionality that will help automate this method of searching.