tags:

views:

92

answers:

1

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?

A: 

Hi there.

Not really an answer as such, but have you tried the latest version of SOSEX.dll?

http://www.stevestechspot.com/

Apparantly version 4.0 of this Dll targets .NET 2.0 and above, and it includes a new !gch command, which lists GC handles. I've never used this version of the DLL, so I don't know if this command will work, but it's worth a shot.

Cheers. Jas.

Jason Evans