C
Chris Oates
I'm using interop to bring in user32.dll and gdi32.dll, and I'm finding that
I appear to have some kind of memory leak in the CLR. use of
GC.GetTotalMemory() shows a lot of motion, but it does not continually grow,
leaving me to think that it's a problem with my interop calls.
I have a timer set up which calls the following function 20 times per
second. It finds the color of the pixel under the mouse cursor. The real
version does more with that info, but even this simple version seems to leak
about 25K/second.
private void timer_Tick(object sender, System.EventArgs e)
{
mousePoint = Control.MousePosition;
IntPtr dc = GetDC(IntPtr.Zero);
int pc = GetPixel(dc, mousePoint.X, mousePoint.Y);
ReleaseDC(dc);
}
Any ideas?
~Chris
I appear to have some kind of memory leak in the CLR. use of
GC.GetTotalMemory() shows a lot of motion, but it does not continually grow,
leaving me to think that it's a problem with my interop calls.
I have a timer set up which calls the following function 20 times per
second. It finds the color of the pixel under the mouse cursor. The real
version does more with that info, but even this simple version seems to leak
about 25K/second.
private void timer_Tick(object sender, System.EventArgs e)
{
mousePoint = Control.MousePosition;
IntPtr dc = GetDC(IntPtr.Zero);
int pc = GetPixel(dc, mousePoint.X, mousePoint.Y);
ReleaseDC(dc);
}
Any ideas?
~Chris