DotMemory '+<>c' classes keeps surviving
We just started working with dotMemory to analyze our memory usages.
After some tweaks almost none of the used classes survived when they are not to.
But we keep seeing '+<>c' classes that survived when I don't think they should.
What are the '+<>c' classes? Are those the constructors? Should they survive?

Please sign in to leave a comment.
Hello,
+<>c type means that you have a function closures in the code. You can read more about closures here:
https://en.wikipedia.org/wiki/Closure_(computer_programming)
For example:
class Program
{
static void Main(string[] args)
{
var data = new[] {1, 2, 3, 4};
var multiplier = 2;
var result = data.Select(x => x * multiplier);
}
}
An object of Program+<>c__DisplayClass1 type (or something like this) will be created when executing x => x * multiplier expression.
Closures act as regular objects, they will be garbage collected as soon as they are out of the execution scope (assuming nobody holds a reference on that closure).
You can use "Key Retention Paths" or "Group by Similar Retention" views to identify why these objects are still in memory.