class testDebug { public: testDebug() { cnt++; } ~testDebug() { --cnt; if (cnt == 0) { delete [] devastator; } } static int cnt; static int* devastator; }; int testDebug::cnt=0; int* testDebug::devastator = new int[666]; int main (char** argc, int argv) { // you probably will not even get here... int j=0; for (int i=0; i < 9; ++i) { j+=i; } return 0; }