Memory Description

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
cszabo
Posts: 2
Joined: Mon May 19, 2008 3:06 pm

Memory Description

Post by cszabo » Mon May 19, 2008 3:11 pm

Good morning everyone.

Last week I began using Memory Profiler to analyze an application I've been working on for some time. There appears to be a memory problem that I cannot resolve. After using the Memory Profile (which is by far the best I've used thus far) I looked at the "Native memory" page.

On this page, under Private > Identified resources I found where the majority of my memory consumption is located: Kernel-VirtualMemory. Unfortunately, I have no idea what this actually means, nor and idea of how to reduce this memory consumption.

Does anyone have information related to the resource and what possible causes of high Kernel-VirtualMemory usage might be?

Thank you for the help.
Christopher Szabo - Net Fusion Corporation - Simple Solutions to Complex Issues

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Tue May 20, 2008 2:40 pm

VirtualMemory is memory that has been allocated using the VirtualAlloc function. This function is mainly used to allocate large blocks of memory that will be suballocated by other memory allocation routines, such as unmanaged and managed heaps.

The profiler tries to associate VirtualMemory with the "real" usage of the memory. For instance, if VirtualMemory is used for the managed heaps, the memory will be presented as "Managed heaps", rather than VirtualMemory.

In your case you have a large amount of memory that is only identified as VirtualMemory. How big is the memory usage? Have you tried to investigate the VirtualMemory instances in the "Types/Resources" view? You might get more information about the VirtualMemory by analysing the allocation call stacks.
Best regards,

Andreas Suurkuusk
SciTech Software AB

cszabo
Posts: 2
Joined: Mon May 19, 2008 3:06 pm

Post by cszabo » Tue May 20, 2008 2:49 pm

I found out what was going on actually. Over 400 MB was being allocated. I had to look at the call stack to see that it was from a GDI call which I presume was being made by the CLR. I was using GDI+ to save an image, but it was in the context of a loop. The fact that it was being saved so often must have been the cause.

Once I removed the Bitmap.Save(string) invocation from the FOR loop the total memory usage dropped to under 20 MB.

I appreciate you taking the time to get back to me.

Thanks.
Christopher Szabo - Net Fusion Corporation - Simple Solutions to Complex Issues

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests