...
"Free" objects are simply regions of space the garbage collector can use later.
-If 30%% or more of the heap contains "Free" objects, the process may suffer from
+If 30% or more of the heap contains "Free" objects, the process may suffer from
heap fragmentation. This is usually caused by pinning objects for a long time
combined with a high rate of allocation. Here is example output where !DumpHeap
provides a warning about fragmentation:
Total 337556 24 306968 8800
Free space: Percentage
- Heap0 28 12 12 64 SOH: 0%% LOH: 0%%
- Heap1 104 12 12 16 SOH: 0%% LOH:100%%
+ Heap0 28 12 12 64 SOH: 0% LOH: 0%
+ Heap1 104 12 12 16 SOH: 0% LOH:100%
Total 132 24 24 80
0:002> !heapstat -inclUnrooted
Total 337556 24 306968 8800
Free space: Percentage
- Heap0 28 12 12 64 SOH: 0%% LOH: 0%%
- Heap1 104 12 12 16 SOH: 0%% LOH:100%%
+ Heap0 28 12 12 64 SOH: 0% LOH: 0%
+ Heap1 104 12 12 16 SOH: 0% LOH:100%
Total 132 24 24 80
Unrooted objects: Percentage
- Heap0 152212 0 306196 0 SOH: 94%% LOH: 0%%
- Heap1 155704 0 0 0 SOH: 97%% LOH: 0%%
+ Heap0 152212 0 306196 0 SOH: 94% LOH: 0%
+ Heap1 155704 0 0 0 SOH: 97% LOH: 0%
Total 307916 0 306196 0
The percentage column contains a breakout of free or unrooted bytes to total bytes.
GC can not commit memory it needs. You can look at these scenarios by using performance
counters or debugger commands. For example for the former scenario the "!address
-summary" debugger command will show you the largest free region in the VM. For
-the latter scenario you can look at the "Memory%% Committed Bytes In Use" see
+the latter scenario you can look at the "Memory% Committed Bytes In Use" see
if you are running low on commit space. One important thing to keep in mind is
when you do this kind of memory analysis it could an aftereffect and doesn't
completely agree with what this command tells you, in which case the command should
tempf = ((float)(hpUsage.genUsage[0].freed + hpUsage.genUsage[1].freed + hpUsage.genUsage[2].freed)) /
(hpUsage.genUsage[0].allocd + hpUsage.genUsage[1].allocd + hpUsage.genUsage[2].allocd);
int pohFreeUsage = heapDetails.has_poh ? (int)(100*((float)hpUsage.genUsage[4].freed) / (hpUsage.genUsage[4].allocd)) : 0;
- ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%",
- (int)(100*((float)hpUsage.genUsage[3].freed) / (hpUsage.genUsage[3].allocd)), "%%",
- pohFreeUsage, "%%");
+ ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%",
+ (int)(100*((float)hpUsage.genUsage[3].freed) / (hpUsage.genUsage[3].allocd)), "%",
+ pohFreeUsage, "%");
if (bIncUnreachable)
{
tempf = ((float)(hpUsage.genUsage[0].unrooted+hpUsage.genUsage[1].unrooted+hpUsage.genUsage[2].unrooted)) /
(hpUsage.genUsage[0].allocd+hpUsage.genUsage[1].allocd+hpUsage.genUsage[2].allocd);
int pohUnrootedUsage = heapDetails.has_poh ? (int)(100*((float)hpUsage.genUsage[4].unrooted) / (hpUsage.genUsage[4].allocd)) : 0;
- ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%",
- (int)(100*((float)hpUsage.genUsage[3].unrooted) / (hpUsage.genUsage[3].allocd)), "%%",
- pohUnrootedUsage, "%%");
+ ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%",
+ (int)(100*((float)hpUsage.genUsage[3].unrooted) / (hpUsage.genUsage[3].allocd)), "%",
+ pohUnrootedUsage, "%");
}
ExtOut("\nCommitted space:");
tempf = ((float)(hpUsage[n].genUsage[0].freed + hpUsage[n].genUsage[1].freed + hpUsage[n].genUsage[2].freed)) /
(hpUsage[n].genUsage[0].allocd + hpUsage[n].genUsage[1].allocd + hpUsage[n].genUsage[2].allocd);
int pohFreeUsage = hasPoh ? (int)(100*((float)hpUsage[n].genUsage[4].freed) / (hpUsage[n].genUsage[4].allocd)) : 0;
- ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%",
- (int)(100*((float)hpUsage[n].genUsage[3].freed) / (hpUsage[n].genUsage[3].allocd)), "%%",
- pohFreeUsage, "%%");
+ ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%",
+ (int)(100*((float)hpUsage[n].genUsage[3].freed) / (hpUsage[n].genUsage[3].allocd)), "%",
+ pohFreeUsage, "%");
}
ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n",
genUsageStat[0].freed, genUsageStat[1].freed,
tempf = ((float)(hpUsage[n].genUsage[0].unrooted + hpUsage[n].genUsage[1].unrooted + hpUsage[n].genUsage[2].unrooted)) /
(hpUsage[n].genUsage[0].allocd + hpUsage[n].genUsage[1].allocd + hpUsage[n].genUsage[2].allocd);
int pohUnrootedUsage = hasPoh ? (int)(100*((float)hpUsage[n].genUsage[4].unrooted) / (hpUsage[n].genUsage[4].allocd)) : 0;
- ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%%",
- (int)(100*((float)hpUsage[n].genUsage[3].unrooted) / (hpUsage[n].genUsage[3].allocd)), "%%",
- pohUnrootedUsage, "%%");
+ ExtOut("SOH:%3d%s LOH:%3d%s POH:%3d%s\n", (int)(100 * tempf), "%",
+ (int)(100*((float)hpUsage[n].genUsage[3].unrooted) / (hpUsage[n].genUsage[3].allocd)), "%",
+ pohUnrootedUsage, "%");
}
ExtOut("Total %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u %12" POINTERSIZE_TYPE "u\n",
genUsageStat[0].unrooted, genUsageStat[1].unrooted,
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ExtOut ("CPU utilization: %d %s\n", threadpool.cpuUtilization, "%%");
+ ExtOut ("CPU utilization: %d %s\n", threadpool.cpuUtilization, "%");
ExtOut ("Worker Thread:");
ExtOut (" Total: %d", threadpool.NumWorkingWorkerThreads + threadpool.NumIdleWorkerThreads + threadpool.NumRetiredWorkerThreads);
ExtOut (" Running: %d", threadpool.NumWorkingWorkerThreads);