简体   繁体   English

如何解释 Valgrind 输出

[英]How to interpret Valgrind output

Valgrind yields the following message block: 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)

How to read this message?如何阅读此消息?

main.cpp line 374 reads: main.cpp 第 374 行内容如下:

results[index] = compute(parameters, weights);

Is memory leaked exactly at line 374 of main.cpp?内存是否恰好在 main.cpp 的第 374 行泄漏? Is it leaked in compute() or maybe at assignment/indexing into results?它是在 compute() 中泄漏还是在分配/索引结果时泄漏?

Is memory leaked exactly at line 374 of main.cpp?内存是否恰好在 main.cpp 的第 374 行泄漏?

No. It just shows the line number in main where the call was made that ultimately leads to the function and line where the memory was allocated.不,它只显示main中调用的行号,最终导致分配内存的函数和行。

Is it leaked in compute() or maybe at assignment/indexing into results?它是在 compute() 中泄漏还是在分配/索引结果时泄漏?

It says that memory was allocated in compute() but was not deallocated in the program before the program exited.它说内存是在compute()中分配的,但在程序退出之前没有在程序中释放。 That's what constitutes a memory leak.这就是构成内存泄漏的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM