c++ 如何理解Valgrind错误消息?

dzjeubhm  于 2023-06-25  发布在  其他
关注(0)|答案(1)|浏览(117)

我是一个普通的C开发人员,但新的Valgrind软件。我遇到了一个问题,在我的C软件,所以我运行Valgrind。不幸的是,我不能阅读。
有没有人能帮我理解和弄清楚可能的问题是什么?
不幸的是,我无法添加源代码,因为它太大了。下面你可以找到Valgrind错误消息。

==11== Callgrind, a call-graph generating cache profiler
==11== Copyright (C) 2002-2017, and GNU GPL'd, by Josef Weidendorfer et al.
==11== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==11== Command: application/aeb/domains/lss/astas_simulation/drafts/ldw_standard_scenario_test
==11== 
==11== For interactive control, run 'callgrind_control -h'.
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from LSSFixture
[ RUN      ] LSSFixture.Test_LdwStandardScenarioXosc
==11== brk segment overflow in thread #1: can't grow to 0x484b000
==11== (see section Limitations in user manual)
==11== NOTE: further instances of this message will not be shown
RoadQuery::checkForRoadData: WARNING: Road Data is not (yet) initialized! Queries are not yet feasible.
 file name /tmp/2023-06-23_09-37-19
 Teardowning 
corrupted double-linked list
==11== 
==11== Process terminating with default action of signal 6 (SIGABRT)
==11==    at 0x14C8400B: raise (raise.c:51)
==11==    by 0x14C63858: abort (abort.c:79)
==11==    by 0x14CCE26D: __libc_message (libc_fatal.c:155)
==11==    by 0x14CD62FB: malloc_printerr (malloc.c:5347)
==11==    by 0x14CD694B: unlink_chunk.isra.0 (malloc.c:1460)
==11==    by 0x14CD6AAE: malloc_consolidate (malloc.c:4502)
==11==    by 0x14CD7FDF: _int_free (malloc.c:4400)
==11==    by 0x5D57694: google::protobuf::RepeatedPtrField<astas_osi3::LidarDetection>::~RepeatedPtrField() (in /home/qxz3ks1/.cache/bazel/_bazel_qxz3ks1/dc8ce1481d65c6006b3adb0b2853086e/execroot/ddad/bazel-out/k8-fastbuild/bin/external/astas_core_ubuntu_20/libastas_core_osi_proto_exports.so)
==11==    by 0x5D4946F: astas_osi3::LidarDetectionData::~LidarDetectionData() (in /home/qxz3ks1/.cache/bazel/_bazel_qxz3ks1/dc8ce1481d65c6006b3adb0b2853086e/execroot/ddad/bazel-out/k8-fastbuild/bin/external/astas_core_ubuntu_20/libastas_core_osi_proto_exports.so)
==11==    by 0x5D494C0: astas_osi3::LidarDetectionData::~LidarDetectionData() (in /home/qxz3ks1/.cache/bazel/_bazel_qxz3ks1/dc8ce1481d65c6006b3adb0b2853086e/execroot/ddad/bazel-out/k8-fastbuild/bin/external/astas_core_ubuntu_20/libastas_core_osi_proto_exports.so)
==11==    by 0x5D57481: google::protobuf::RepeatedPtrField<astas_osi3::LidarDetectionData>::~RepeatedPtrField() (in /home/qxz3ks1/.cache/bazel/_bazel_qxz3ks1/dc8ce1481d65c6006b3adb0b2853086e/execroot/ddad/bazel-out/k8-fastbuild/bin/external/astas_core_ubuntu_20/libastas_core_osi_proto_exports.so)
==11==    by 0x5D490B3: astas_osi3::FeatureData::~FeatureData() (in /home/qxz3ks1/.cache/bazel/_bazel_qxz3ks1/dc8ce1481d65c6006b3adb0b2853086e/execroot/ddad/bazel-out/k8-fastbuild/bin/external/astas_core_ubuntu_20/libastas_core_osi_proto_exports.so)
==11== 
==11== Events    : Ir
==11== Collected : 19062663992
==11== 
==11== I   refs:      19,062,663,992
================================================================================
Target //application/aeb/domains/lss/astas_simulation/drafts:ldw_standard_scenario_test up-to-date:
  bazel-bin/application/aeb/domains/lss/astas_simulation/drafts/ldw_standard_scenario_test
INFO: Elapsed time: 207.572s, Critical Path: 207.00s
INFO: 2 processes: 2 linux-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//application/aeb/domains/lss/astas_simulation/drafts:ldw_standard_scenario_test FAILED in 206.9s
  /home/qxz3ks1/.cache/bazel/_bazel_qxz3ks1/dc8ce1481d65c6006b3adb0b2853086e/execroot/ddad/bazel-out/k8-fastbuild/testlogs/application/aeb/domains/lss/astas_simulation/drafts/ldw_standard_scenario_test/test.log

Executed 1 out of 1 test: 1 fails locally.

先谢谢你了

46qrfjad

46qrfjad1#

据我所知
您的程序有一个分段错误,正如错误消息所说。当程序试图访问或访问不应该访问的内存时,例如阅读或写入错误的内存地址时,就会发生这种情况。
错误通知进一步指出,程序试图释放内存时出现问题。错误信息damaged double-linked list,特别是,表明程序中内存的分配和释放方式可能存在问题。
很难找到确切的问题。一些原因是:

  • 释放实际上是免费的内存
  • 试图释放不是由“malloc”或“new”分配的内存
  • 写入内存超过已分配内存块的末尾

正如我所说,很难确定确切的问题。您可以尝试寻找上面提到的可能的问题。您也可以尝试使用调试器来查找有关问题的更多信息。
希望这对你有帮助。

相关问题