Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3425404
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:35:23+00:00 2026-05-18T06:35:23+00:00

I’m building an application with the Dyninst API, and with a simple Hello World

  • 0

I’m building an application with the Dyninst API, and with a simple Hello World application have many many memory leaks. Dyninst is managing its own memory, in part, and I’m curious if Valgrind would report that memory as “leaked”.

I’m using C++ and an not 100% comfortable with it quite yet, so if I forgot to include any information that would be helpful, please say so.

Thanks!

http://www.dyninst.org/


Here is the Hello World application:

#include "BPatch.h"
int main(int argc, char** argv) {
  BPatch bpatch;
}

Valgrind Output:

==10307== Memcheck, a memory error detector.
==10307== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.
==10307== Using LibVEX rev 1884, a library for dynamic binary translation.
==10307== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.
==10307== Using valgrind-3.4.1-Debian, a dynamic binary instrumentation framework.
==10307== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.
==10307== For more details, rerun with: -v
==10307== 
==10307== 
==10307== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 31 from 1)
==10307== malloc/free: in use at exit: 16,021 bytes in 422 blocks.
==10307== malloc/free: 2,198 allocs, 1,776 frees, 74,304 bytes allocated.
==10307== For counts of detected errors, rerun with: -v
==10307== searching for pointers to 422 not-freed blocks.
==10307== checked 8,642,848 bytes.
==10307== 
==10307== 44 (12 direct, 32 indirect) bytes in 1 blocks are definitely lost in loss record 51 of 95
==10307==    at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224)
==10307==    by 0x46505EF: Dyninst::SymtabAPI::typeCollection::getAllTypes() (Collections.C:515)
==10307==    by 0x46223F6: Dyninst::SymtabAPI::Symtab::getAllstdTypes() (Symtab.C:2182)
==10307==    by 0x435E510: BPatch::BPatch() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x804914B: main (mutator.c:14)
==10307== 
==10307== 
==10307== 20 bytes in 1 blocks are definitely lost in loss record 52 of 95
==10307==    at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224)
==10307==    by 0x438C3C4: BPatch_type::BPatch_type(Dyninst::SymtabAPI::Type*) (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x435E54F: BPatch::BPatch() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x804914B: main (mutator.c:14)
==10307== 
==10307== 
==10307== 266 (72 direct, 194 indirect) bytes in 2 blocks are definitely lost in loss record 69 of 95
==10307==    at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224)
==10307==    by 0x438B6D7: BPatch_type::BPatch_type(char const*, int, BPatch_dataClass) (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x438BCAA: BPatch_type::createFake(char const*) (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x435E4DB: BPatch::BPatch() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x804914B: main (mutator.c:14)
==10307== 
==10307== 
==10307== 1,412 bytes in 60 blocks are possibly lost in loss record 82 of 95
==10307==    at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224)
==10307==    by 0x4817AD3: std::string::_Rep::_S_create(unsigned int, unsigned int, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.10)
==10307==    by 0x4818734: (within /usr/lib/libstdc++.so.6.0.10)
==10307==    by 0x48188A5: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.10)
==10307==    by 0x4665707: global constructors keyed to annotations.C (annotations.C:38)
==10307==    by 0x4666E3C: (within ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libsymtabAPI.so)
==10307==    by 0x45A85AF: (within ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libsymtabAPI.so)
==10307==    by 0x400E343: (within /lib/ld-2.9.so)
==10307==    by 0x400E473: (within /lib/ld-2.9.so)
==10307==    by 0x400084E: (within /lib/ld-2.9.so)
==10307== 
==10307== 
==10307== 3,657 (72 direct, 3,585 indirect) bytes in 1 blocks are definitely lost in loss record 84 of 95
==10307==    at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224)
==10307==    by 0x435E583: BPatch::BPatch() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x804914B: main (mutator.c:14)
==10307== 
==10307== 
==10307== 268 (12 direct, 256 indirect) bytes in 1 blocks are definitely lost in loss record 85 of 95
==10307==    at 0x40269EE: operator new(unsigned int) (vg_replace_malloc.c:224)
==10307==    by 0x465072F: Dyninst::SymtabAPI::builtInTypeCollection::getAllBuiltInTypes() (Collections.C:673)
==10307==    by 0x46223C6: Dyninst::SymtabAPI::Symtab::getAllbuiltInTypes() (Symtab.C:2188)
==10307==    by 0x435E598: BPatch::BPatch() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x804914B: main (mutator.c:14)
==10307== 
==10307== 
==10307== 144 bytes in 1 blocks are possibly lost in loss record 91 of 95
==10307==    at 0x4025092: calloc (vg_replace_malloc.c:397)
==10307==    by 0x401128B: _dl_allocate_tls (in /lib/ld-2.9.so)
==10307==    by 0x4A0F672: pthread_create@@GLIBC_2.1 (in /lib/tls/i686/cmov/libpthread-2.9.so)
==10307==    by 0x441B852: InternalThread::createThread() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x44543B5: BPatch_asyncEventHandler::initialize() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x435E62A: BPatch::BPatch() (in ~/Desktop/Masters/dyninstAPI/src/i386-unknown-linux2.4/lib/libdyninstAPI.so)
==10307==    by 0x804914B: main (mutator.c:14)
==10307== 
==10307== LEAK SUMMARY:
==10307==    definitely lost: 188 bytes in 6 blocks.
==10307==    indirectly lost: 4,067 bytes in 46 blocks.
==10307==      possibly lost: 1,556 bytes in 61 blocks.
==10307==    still reachable: 10,210 bytes in 309 blocks.
==10307==         suppressed: 0 bytes in 0 blocks.
==10307== Reachable blocks (those to which a pointer was found) are not shown.
==10307== To see them, rerun with: --leak-check=full --show-reachable=yes
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:35:24+00:00Added an answer on May 18, 2026 at 6:35 am

    Valgrind is blind to what is your code and what is a library. It is likely reporting a leak in the library.

    You can see what leaked by running, as suggested, with --leak-check=full

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.