Step 1 : include function #include
Step2: enable warning to standard output , default to screen
此範例 把output 設為file, 但實際執行還是跑到 screen
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
step 3: 宣告變數
_CrtMemState memstate[5];
_CrtMemState memdiff;
step 4
a. 在要 夾集的兩端 用 _CrtMemCheckpoint() 紀錄memory 狀態
b. 然後用 _CrtMemDumpStatistics() 比較
c _CrtMemDumpStatistics() , 送出資料
_CrtMemCheckpoint(memstate);
Algori_1(algo1_input);
_CrtMemCheckpoint(memstate+1);
_CrtMemDifference(&memdiff,memstate,memstate+1);
_CrtMemDumpStatistics(&memdiff);
沒有留言:
張貼留言