GDI leak detection method:
1. Check whether getwindowdc () and releasedc () exist ()
2. cfont * poldfont = PDC-> SelectObject (& m_font );
Whether there is PDC-> SelectObject (poldfont );
3. cbitmap BMP;
BMP. createcompatiblebitmap (& DC, rcclient. Width (), rcclient. Height ());
Do you remember BMP. deleteobject ();
Memory leakage detection method
1. Check new, virtualalloc,HeapAlloc,malloc Is it not released?
2. _ crtmemstate S1, S2, S3;
_ Crtmemcheckpoint (& S1 );
// Memory allocations take place here
_ Crtmemcheckpoint (& S2 );
If (_ crtmemdifference (& S3, & S1, & S2 ))
_ Crtmemdumpstatistics (& S3 );
Cmemorystate msold;
Msold. Checkpoint ();
Msold. dumpallobjectssince ();
3. _ crtsetbreakalloc (18 );
4. boundschecker Tool
5. F:/RTM/vctools/vc7libs/ship/atlmfc/src/mfc/strcore. cpp (141)
If the above output is displayed, use _ crtdumpmemoryleaks (); for debugging.
F:/sourcesafe fold/mccsclient/mccsclientdlg. cpp (1863): {63669} normal block at 0x02f21278, 8 bytes long.
Data: <x> E8 CC F1 02 F0 78 F1 02
Generally, this problem is caused by cstring. simply change it to the char pointer type.