#include <iostream> using namespace std; #ifdef _DEBUG #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__) #else #define DEBUG_CLIENTBLOCK #endif #define _CRTDBG_MAP_ALLOC #ifdef _DEBUG #define new DEBUG_CLIENTBLOCK #endif int main(int argc, char* argv[]) { int* p = new int[5]; _CrtDumpMemoryLeaks(); return 0; } 工具->选项->调试-> 这个不能打钩