Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. tool recommendations: C heap leak checker that works with C++ code

tool recommendations: C heap leak checker that works with C++ code

Scheduled Pinned Locked Moved The Lounge
c++designcsscomgraphics
19 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    honey the codewitch
    wrote on last edited by
    #1

    I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

    B R S R L 8 Replies Last reply
    0
    • H honey the codewitch

      I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

      B Offline
      B Offline
      BernardIE5317
      wrote on last edited by
      #2

      perhaps you may consider writing your own equivalent of stl::unique_ptr etc.

      H 1 Reply Last reply
      0
      • B BernardIE5317

        perhaps you may consider writing your own equivalent of stl::unique_ptr etc.

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #3

        I've considered it, but I should also need to use the emplace new operator and I'm currently not doing that, so I'm not using RAII. I could, but it would require retooling quite a bit of code. Another related reason I'm not using RAII is this evolved from a reference implementation in C.

        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

        1 Reply Last reply
        0
        • H honey the codewitch

          I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

          B Offline
          B Offline
          BernardIE5317
          wrote on last edited by
          #4

          i wrote such a tool many years ago . it was simple crude but effective . as best i recall it merely placed an intermediary / agent in front of malloc / free so kept records . at program exit of course its vector should be empty . it also read and stored from the stack the malloc call site so as to permit identifying the responsible party .

          H 1 Reply Last reply
          0
          • B BernardIE5317

            i wrote such a tool many years ago . it was simple crude but effective . as best i recall it merely placed an intermediary / agent in front of malloc / free so kept records . at program exit of course its vector should be empty . it also read and stored from the stack the malloc call site so as to permit identifying the responsible party .

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #5

            See that's what I was looking for. I used to use a 3rd party tool for it, because I am paranoid about bugs in my debug code, you know? I just can't remember what it was, since it has been too long.

            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

            S 1 Reply Last reply
            0
            • H honey the codewitch

              See that's what I was looking for. I used to use a 3rd party tool for it, because I am paranoid about bugs in my debug code, you know? I just can't remember what it was, since it has been too long.

              Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

              S Offline
              S Offline
              Shao Voon Wong
              wrote on last edited by
              #6

              I use Deleaker[^] to find leaks in Visual Studio.

              H 1 Reply Last reply
              0
              • S Shao Voon Wong

                I use Deleaker[^] to find leaks in Visual Studio.

                H Offline
                H Offline
                honey the codewitch
                wrote on last edited by
                #7

                Oooh thank you! I'll give that a shot. Update: Works fantastically. Thanks again!

                Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                1 Reply Last reply
                0
                • H honey the codewitch

                  I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                  R Offline
                  R Offline
                  RickZeeland
                  wrote on last edited by
                  #8

                  For Linux: AddressSanitizerLeakSanitizer[^] Also see: AddressSanitizer — Clang 18.0.0git documentation[^] Something similar exists for Visual Studio, see CodeProject article: Address Sanitizer in Visual C++[^] For a comparison between AddressSanitizer and Other Memory Detect Tools, see: Medium article[^] :-\

                  1 Reply Last reply
                  0
                  • H honey the codewitch

                    I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                    S Offline
                    S Offline
                    Storm blade
                    wrote on last edited by
                    #9

                    Try [DrMemory](https://drmemory.org/).

                    H 1 Reply Last reply
                    0
                    • S Storm blade

                      Try [DrMemory](https://drmemory.org/).

                      H Offline
                      H Offline
                      honey the codewitch
                      wrote on last edited by
                      #10

                      Thanks. Unlike Deleaker it's free, but looks a little bit cumbersome to use relatively (not saying it's awkward, it's just that deleaker is very slick workflow-wise) I'll give them a comparison run.

                      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                      1 Reply Last reply
                      0
                      • H honey the codewitch

                        I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

                        Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                        R Offline
                        R Offline
                        Rick York
                        wrote on last edited by
                        #11

                        If you can run the code in windows and compile with Visual Studio then you can use its built-in facility along with this header file : Memory Allocation Tracking for C++ Code[^].

                        "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                        H 1 Reply Last reply
                        0
                        • R Rick York

                          If you can run the code in windows and compile with Visual Studio then you can use its built-in facility along with this header file : Memory Allocation Tracking for C++ Code[^].

                          "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                          H Offline
                          H Offline
                          honey the codewitch
                          wrote on last edited by
                          #12

                          Yeah, that's an option, although less than ideal as my code isn't currently tied to a particular compiler. That said I could probably keep the blast radius of the changes small enough to manage. However, I've been pointed to Deleaker which worked aces and didn't require me to instrument my code.

                          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                          1 Reply Last reply
                          0
                          • H honey the codewitch

                            I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

                            Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                            L Offline
                            L Offline
                            Luca Leonardo Scorcia
                            wrote on last edited by
                            #13

                            Back when I still did C++ stuff I used BoundsChecker, not sure if it's still around... was that the one you didn't remember?

                            Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása

                            H J 2 Replies Last reply
                            0
                            • L Luca Leonardo Scorcia

                              Back when I still did C++ stuff I used BoundsChecker, not sure if it's still around... was that the one you didn't remember?

                              Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása

                              H Offline
                              H Offline
                              honey the codewitch
                              wrote on last edited by
                              #14

                              You know what? That sounds familiar, so it's likely. I'll look into it, thanks!

                              Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                              1 Reply Last reply
                              0
                              • H honey the codewitch

                                I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

                                Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                M Offline
                                M Offline
                                Mladen Jankovic
                                wrote on last edited by
                                #15

                                [Application Verifier](https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/application-verifier)

                                1 Reply Last reply
                                0
                                • H honey the codewitch

                                  I have to use STL-less C++ w/ malloc instead of new because embedded devices often have multiple heaps. I've built out a set of complicated classes that do a lot of little allocations and I need a tool to check and make sure I'm not leaking. I haven't used one of these in so many years I can't even remember the names of the tools I used to use. Any recommends?

                                  Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                  A Offline
                                  A Offline
                                  Amarnath S
                                  wrote on last edited by
                                  #16

                                  Many centuries ago, had used VTune. It's still around. https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html

                                  H 1 Reply Last reply
                                  0
                                  • A Amarnath S

                                    Many centuries ago, had used VTune. It's still around. https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html

                                    H Offline
                                    H Offline
                                    honey the codewitch
                                    wrote on last edited by
                                    #17

                                    My experience with Intel tools is they have been clunky at best and confusing at worst, so I tend to avoid them if I have other solutions. In this case I do. So thank you, but no offense, I'll pass on VTune.

                                    Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                    A 1 Reply Last reply
                                    0
                                    • H honey the codewitch

                                      My experience with Intel tools is they have been clunky at best and confusing at worst, so I tend to avoid them if I have other solutions. In this case I do. So thank you, but no offense, I'll pass on VTune.

                                      Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                                      A Offline
                                      A Offline
                                      Amarnath S
                                      wrote on last edited by
                                      #18

                                      :thumbsup:

                                      1 Reply Last reply
                                      0
                                      • L Luca Leonardo Scorcia

                                        Back when I still did C++ stuff I used BoundsChecker, not sure if it's still around... was that the one you didn't remember?

                                        Luca The Price of Freedom is Eternal Vigilance. -- Wing Commander IV En Það Besta Sem Guð Hefur Skapað, Er Nýr Dagur. (But the best thing God has created, is a New Day.) -- Sigur Ròs - Viðrar vel til loftárása

                                        J Offline
                                        J Offline
                                        jschell
                                        wrote on last edited by
                                        #19

                                        Luca Leonardo Scorcia wrote:

                                        I used BoundsChecker

                                        Yes I remember that too. I think that was one of the very few tools I bought back then. Probably along with the Borland IDE. But far as I can tell you can't get just that (by itself) anymore.

                                        1 Reply Last reply
                                        0
                                        Reply
                                        • Reply as topic
                                        Log in to reply
                                        • Oldest to Newest
                                        • Newest to Oldest
                                        • Most Votes


                                        • Login

                                        • Don't have an account? Register

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • World
                                        • Users
                                        • Groups