!gcroot output leads nowhere

Posted by Jeff Costa on Stack Overflow See other posts from Stack Overflow or by Jeff Costa
Published on 2010-05-20T20:58:11Z Indexed on 2010/05/20 21:00 UTC
Read the original article Hit count: 174

Filed under:
|

I am troubleshooting memory fragmentation in an app pool, as evidenced by a small number of Free objects consuming the most space on the heap:

0x000007ff00256728    6,543   3,890,208 System.Collections.Hashtable+bucket[]  
0x000007ff002649a8    7,297   22,979,560 System.Byte[]  
0x000007ff001e0d90  251,347   30,374,304 System.String  
0x0000000001d0c830      373   48,036,816      Free  

Running the !dumpgen 3 command reveals the fragmentation; There is a repeating pattern of Free and System.Object objects of the same size:

000000017feb7350         24 **** FREE ****
000000017feb7368       8192 System.Object[]  
000000017feb9368         24 **** FREE ****  
000000017feb9380       8192 System.Object[]  
000000017febb380         24 **** FREE ****  
000000017febb398       8192 System.Object[]  
000000017febd398         24 **** FREE ****  
000000017febd3b0       8192 System.Object[]  
000000017febf3b0         24 **** FREE ****  
000000017febf3c8       8192 System.Object[]  
000000017fec13c8         24 **** FREE ****  
000000017fec13e0       8192 System.Object[]  
000000017fec33e0         24 **** FREE ****  
000000017fec33f8       8192 System.Object[]  
000000017fec53f8         24 **** FREE ****  
000000017fec5410      14024 System.Object[]  
000000017fec8ad8         24 **** FREE ****  
000000017fec8af0       8192 System.Object[]  
000000017fecaaf0         24 **** FREE ****  
000000017fecab08       8192 System.Object[]  
000000017feccb08         24 **** FREE ****  
000000017feccb20       8192 System.Object[]  
000000017feceb20         24 **** FREE ****  
000000017feceb38       8192 System.Object[]  
000000017fed0b38         24 **** FREE ****  
000000017fed0b50       8192 System.Object[]  
000000017fed2b50         24 **** FREE ****  
000000017fed2b68       8192 System.Object[]  

When I try to obtain the root of one of the System.Objects with !gcroot, I get a pinned handle, but no additional stack data:

Scan Thread 41 OSThread 1044  
DOMAIN(0000000001D51330):HANDLE(Pinned):15217e8:Root:  000000017fe60fe8(System.Object[])  

As you can see, there is no additional data to go on. Running a !handle command also yields nothing:

0:041> !handle 000000017fe7a068 ff  
Handle 000000017fe7a068  
Type            <Error retrieving type>  
unable to query object information  
unable to query object information  
No object specific information available  

How can I trace out this memory leak when I cannot find what is rooting System.Object?

© Stack Overflow or respective owner

Related posts about WinDbg

Related posts about .NET