0
Valgrind的產生以下消息塊:如何解釋Valgrind的輸出
1,065,024 bytes in 66,564 blocks are definitely lost in loss record 21 of 27
at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x40CA21: compute(Parameters&, Array<double>&) [clone .constprop.71] (array.hpp:135)
by 0x403E70: main (main.cpp:374)
如何解讀該消息?
的main.cpp行374讀取:
results[index] = compute(parameters, weights);
的內存正好在main.cpp中的374線泄露?它是在compute()中泄漏還是在賦值/索引到結果中?
'compute()'是如何聲明的? – wallyk
什麼是array.hpp:135?泄漏可能在計算函數內部,但我猜猜計算是內聯的,所以你不會從valgrind得到確切的行數。拉出偵探帽;) –
它被聲明爲:double compute(參數&參數,數組&數組) –
Konsta