當我試圖編譯我的程序時出現堆損壞錯誤。有問題的代碼是一個指針堆腐敗C++
cparticle * particles.
它被初始化爲NULL,然後設置爲
particles = new cparticle[amount]
我只使用在析構函數刪除一次,它是導致Windows觸發一個斷點。我試圖使用的應用驗證,它給我這個信息:
===========================================================
VERIFIER STOP 0000000000000013: pid 0x17C0: first chance access violation for current stack trace
000000001D54A0A4 : Invalid address being accessed
0000000055741DC6 : Code performing invalid access
000000000025E9D0 : Exception record. Use .exr to display it.
000000000025E4E0 : Context record. Use .cxr to display it.
===========================================================
This verifier stop is continuable.
After debugging it use `go' to continue.
===========================================================
=======================================
VERIFIER STOP 00000013: pid 0x17C0: First chance access violation for current stack trace.
1D54A0A4 : Invalid address causing the exception.
55741DC6 : Code address executing the invalid access.
001DF30C : Exception record.
001DF35C : Context record.
=======================================
This verifier stop is continuable.
After debugging it use `go' to continue.
=======================================
我不能確定什麼,我做錯了,所以任何幫助將不勝感激。
除非我們看到更多的代碼,否則我們很難進行調試。 – Mysticial
顯示代碼將有助於弄清楚你錯了什麼。 – Vinzenz
同意@Mysticial和@Vinzenz。作爲第一個問題;你使用'delete'還是'delete []'? –