Michal
Michal

Reputation: 1406

.NET Pinning handle in memory dump with no interop or fixed

I am investigating memory dump from production and I see lot of references with "Pinning handle" as you can see on screenshot below (from Jetbrains dotMemory). We are not using fixed and we are not doing anything with unmanaged resources around this code so I would like to ask how is that possible? SiteManager class is singleton so there is

private static SiteManager _instance;

field in code which keeps reference to that object forever. But I don't see any reason why this would cause pinning.

enter image description here

Upvotes: 3

Views: 455

Answers (1)

Ed Pavlov
Ed Pavlov

Reputation: 2508

Most likely, the array of objects is one of the internal CLR objects used to store static references. So it is not your object pinned, it's array keeping static references pinned.

[EDIT] I said "most likely" because I don't know your program. If you, as an author of this program, sure that it is not "your" object[], that's for sure it is an array keeping "static reference GC root".

Here and here you can read a little about GC roots

But there is nothing about array of objects due to it seems the internal .NET implementation details. I know about it from my experience as a dotMemory developer.

Upvotes: 2

Related Questions