开发者

what does HANDLE(RefCnt) mean in windbg?

开发者 https://www.devze.com 2023-03-20 04:40 出处:网络
The following is my checking gcroot of the object 0330e9a8. I found Its root is a hanle with its type is \"RefCnt\".

The following is my checking gcroot of the object 0330e9a8. I found Its root is a hanle with its type is "RefCnt".

How could I get the actual reference count of it. And How could I know WHICH object obtained its reference?

0:042> !GCRoot 0330e9a8 
Note: Roots found on stacks may be false positives. Run "!help gcroot" for
more info.
Scan Thread 5 OSTHread 534
Scan Thread 8 OSTHread 60c
Scan Thread 9 OSTHread 1120
Scan Thread 10 OSTHread 1b30
Scan Thread 11 OSTHread 52c
Scan Thread 12 OSTHread 1da8
Scan Thread 15 OSTHread 1cbc
Scan Thread 19 OSTHread 1808
Scan Thread 22 OSTHread 1b6c
Scan Thread 23 OSTHread 1e7开发者_JS百科0
Scan Thread 0 OSTHread 1a34
Scan Thread 32 OSTHread 1840
DOMAIN(001C1050):HANDLE(RefCnt):d31460:Root:0330edf8(xxxxxxx)->
0330eedc(xxxxxxxxxxxx)->
0330e9a8(xxxxxxxxxxxxxx)


It's a GC handle that keeps .NET objects reachable for unmanaged code.
for example: subscribing to COM object event.

What types of roots would you normally see when running !gcroot and what do they mean?
ESP: ESP=Extended Stack Pointer, Object is in use on a stack
Strong: Strong reference, Typically a static variable
WeakLn: Weak Long Handle, A weak reference that is tracked through finalization (can be resurrected)
WeakSh: Weak Short Handle, A weak reference, can't be resurrected
Pinned: Pinned object, pinned at a specific address, can't move around during garbage collection.
RefCnt: Reference count, referenced as long as the reference count is > 0.

See: .NET Debugging Demos Lab 7: Memory Leak - Review

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号