free釋放指針內存報錯:CRT detected that the application wrote to memory after end of heap buffer

win32程序調試時,malloc分配內存,在最後free釋放內存時報錯,原代碼如下: 這裏,在調用malloc分配完內存後, pstr的首地址爲 0x00c5abb0, 將這個地址複製到內存窗口中,跟蹤內存,結果如下: pstr分配的字節大小是32個字節, 所以這裏有32個未初始化的字節被置爲0xcd, 後面的4個0xfd是微軟C++ debugging 堆用該值標記"no man's land
相關文章
相關標籤/搜索