0

I am a regular C++ developer, but new to Valgrind software. I am facing a problem in my C++ software so that I ran Valgrind. Unfortunately, I could't able to read.

Could someone help me to understand and figure out what the possible problem might be?

Unfortunately, I could not add the source code, since it is too large. Below you can find the Valgrind error message.

==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.

Thanks in advance

ks1322
  • 33,961
  • 14
  • 109
  • 164
  • https://stackoverflow.com/questions/35129135/valgrind-reporting-a-segment-overflow ? – KamilCuk Jun 23 '23 at 11:54
  • Why are you running Callgrind tool? Do you want to improve performance of your program? What problem are you facing? – ks1322 Jun 23 '23 at 11:55
  • `==11== brk segment overflow in thread #1: can't grow to 0x484b000` there was an attempt to allocate more memory than is available in the program's memory space. `RoadQuery::checkForRoadData: WARNING: Road Data is not (yet) initialized!` there might be an issue with accessing uninitialized data. `corrupted double-linked list` Memory corruption. The stack trace goes through several functions, including malloc and functions related to google::protobuf. It seems that there might be a memory corruption issue related to the use of the google::protobuf library – Mahendra Panpalia Jun 23 '23 at 14:03

1 Answers1

0

As far as I get it,

Your program has a segmentation fault, as the error message says. This happens when program tries to access or accessing a memory that it shouldn't, such as reading or writing to an incorrect memory address.

The error notice further indicates that the problem arises when the program attempts to release memory. The error message damaged double-linked list, in particular shows that there may be a problem with how memory is allocated and deallocated in your program.

It's very hard to find the exact problem. Some causes are:

  • Freeing the memory which is actually free
  • Trying to free a memory which was not allocated by malloc or new
  • Writing a memory past the end of allocated memory block

As I said, it is very hard to pinpoint the exact issue. You can try looking for the possible problems mentioned above. You can also try to use a debugger to find more about the problem.

Hope this helps you.

Marco Pagliaricci
  • 1,366
  • 17
  • 31