rendering context use more and more memory

I write a program with MFC of microsoft. its view is a OpenGL window, and sometimes a dialog prompt out, this dialog also have OpenGL rendering context

so In my program there are more than 2 rendering contexts and some other render contexts are generated and destroyed as the program running.

I found that eatch time a new rendering contexts generate and then destroyed , the program use more memory.

so the result is as the program running with opengl rendering contexts generate and destroy, the program eat more and more memory,
first in my “task management window” the program use 10M,after a while, it use 50M memory

could you tell me what is the matter

Add-ons:
the dialog is a modal dialog

hi,

This wouldn’t be on an ATI card would it?
If so there are reports that wglMakeCurrent cuases leaks on ATI cards.
see here

it seems that it is not only happen on a ati

and not caused by wglMakeCurrent()

that is a example of mine
could any body take his or her time to have a look at it if it has any problem in it

int COpenGL::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;

// TODO: Add your specialized creation code here
	MySetPixelFormat(::GetDC(m_hWnd));

	hdc = ::GetDC(m_hWnd);
	hglrc = wglCreateContext(hdc);


return 0;

}

===============

void COpenGL::OnPaint()
{
//CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here

wglMakeCurrent(hdc, hglrc);	
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	
s+=0.005;
if(s>1.0)
	s=0.1;
step = step + 1.0;
if (step > 360.0)
	step = step - 360.0;
glPushMatrix();
glScalef(s,s,s);
glRotatef(step,0.0,1.0,0.0);
glRotatef(step,0.0,0.0,1.0);
glRotatef(step,1.0,0.0,0.0);
DrawColorBox();
glPopMatrix();
glFlush();

SwapBuffers(hdc);

wglMakeCurrent(NULL, NULL);	

// Do not call CWnd::OnPaint() for painting messages

}

=====================

int COpenGL::MySetPixelFormat(HDC hdc)
{
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 };

int  iPixelFormat; 

	if((iPixelFormat = ChoosePixelFormat(hdc, &pfd)) == 0)
{
	MessageBox("ChoosePixelFormat Failed", NULL, MB_OK);
	return 0;
}
 
	if(SetPixelFormat(hdc, iPixelFormat, &pfd) == FALSE)
{
	MessageBox("SetPixelFormat Failed", NULL, MB_OK);
	return 0;
}

return 1;

}

======================

COpenGL::OnDestroy()
{

wglMakeCurrent(NULL, NULL) ;
wglDeleteContext(hglrc); ::ReleaseDC (m_hWnd, hdc) ;
}

codes pasted
can any answer my question