How am i free out the allocate memory? My code just something show below.
When I monitor my memory usage with the System Task Manager, I notice that when I run this function it will increase the memory used by 4K. Why the delete function seem to be not working properly? It is my code miss out some important syntax?

10X thanks for reading my thread.

Code:
void Drawline(HWND hDlg)
{
   int   pCnt;
   HPEN  hPen;
   HDC   picHDC;
   POINT *pt = new POINT[1024];
   
   for(pCnt=0; pCnt < 1025; pCnt++)
   {
      pt[pCnt].x = pCnt;
      pt[pCnt].y = pCnt;
   }
   
   hPen = CreatePen (PS_SOLID, 1, RGB(255,0,0)); 
   picHDC = GetDC(hDlg);
   SelectObject(picHDC, hPen);

   Polyline(picHDC, pt, 1024);
   UpdateWindow(hDlg);

   DeleteObject(hPen);
   DeleteDC(picHDC);
   delete [] pt;
   return;
}


[Edited by Chris on 11-10-2000 at 04:19 AM]