We upgrade from VC8 to VC10 and discover a series of memory leaks that are apparently related to CDialog. The simplest example of this is demonstrated with the following code using CDialog, which has only a few buttons. In VC10 this is a leak, but in VC8 it is not:
for (int i = 0; i < 5000; ++i) { CDialog* dialog = new CDialog; dialog->Create(IDD_LEAKER, 0); dialog->DestroyWindow(); delete dialog; }
Memory usage continues to grow, and in the example dialog we have about 30 leak buttons 10 s Mb.
Please note that the above is a test case in which we removed all of our code processing code, in our real code we have a derived class and use PostNcDestroy ().
Oddly enough, none of the following code examples flow in either VC8 or VC10:
CDialog* dialog = new CDialog; for (int i = 0; i < 5000; ++i) { dialog->Create(IDD_LEAKER, 0); dialog->DestroyWindow(); } delete dialog; for (int i = 0; i < 5000; ++i) { CDialog* dialog = new CDialog; delete dialog; }
What are we missing here?
lilburne
source share