Valgrind: suppress memory memory leak reporting iff program crashed












0















Let's assume we have automated Valgrind testing setup with maximum diagnostics configured (--leak-check=yes --track-origins=yes etc.) However, on some tests the valgrinded process might crash with SIGSEGV due to some nondeterministic bug. In that case, the immediate diagnostics leading to SIGSEGV are useful, but Valgrind does not stop there and dumps every single live memory allocation as a leak, tens of thousands of them - which are useless in the case of random SIGSEGV.



Is there a way to configure Valgrind to




  • print any errors during the program execution and do not abort;

  • on regular exit, dump memory leaks;

  • on SIGSEGV/SIGABRT/SIGILL/SIG... exit, do not dump memory leaks?


EDIT: this has been logged at Valgrind bug tracker in 2011: https://bugs.kde.org/show_bug.cgi?id=265371










share|improve this question





























    0















    Let's assume we have automated Valgrind testing setup with maximum diagnostics configured (--leak-check=yes --track-origins=yes etc.) However, on some tests the valgrinded process might crash with SIGSEGV due to some nondeterministic bug. In that case, the immediate diagnostics leading to SIGSEGV are useful, but Valgrind does not stop there and dumps every single live memory allocation as a leak, tens of thousands of them - which are useless in the case of random SIGSEGV.



    Is there a way to configure Valgrind to




    • print any errors during the program execution and do not abort;

    • on regular exit, dump memory leaks;

    • on SIGSEGV/SIGABRT/SIGILL/SIG... exit, do not dump memory leaks?


    EDIT: this has been logged at Valgrind bug tracker in 2011: https://bugs.kde.org/show_bug.cgi?id=265371










    share|improve this question



























      0












      0








      0








      Let's assume we have automated Valgrind testing setup with maximum diagnostics configured (--leak-check=yes --track-origins=yes etc.) However, on some tests the valgrinded process might crash with SIGSEGV due to some nondeterministic bug. In that case, the immediate diagnostics leading to SIGSEGV are useful, but Valgrind does not stop there and dumps every single live memory allocation as a leak, tens of thousands of them - which are useless in the case of random SIGSEGV.



      Is there a way to configure Valgrind to




      • print any errors during the program execution and do not abort;

      • on regular exit, dump memory leaks;

      • on SIGSEGV/SIGABRT/SIGILL/SIG... exit, do not dump memory leaks?


      EDIT: this has been logged at Valgrind bug tracker in 2011: https://bugs.kde.org/show_bug.cgi?id=265371










      share|improve this question
















      Let's assume we have automated Valgrind testing setup with maximum diagnostics configured (--leak-check=yes --track-origins=yes etc.) However, on some tests the valgrinded process might crash with SIGSEGV due to some nondeterministic bug. In that case, the immediate diagnostics leading to SIGSEGV are useful, but Valgrind does not stop there and dumps every single live memory allocation as a leak, tens of thousands of them - which are useless in the case of random SIGSEGV.



      Is there a way to configure Valgrind to




      • print any errors during the program execution and do not abort;

      • on regular exit, dump memory leaks;

      • on SIGSEGV/SIGABRT/SIGILL/SIG... exit, do not dump memory leaks?


      EDIT: this has been logged at Valgrind bug tracker in 2011: https://bugs.kde.org/show_bug.cgi?id=265371







      valgrind memcheck






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 11 at 14:47







      Laurynas Biveinis

















      asked Nov 28 '18 at 17:59









      Laurynas BiveinisLaurynas Biveinis

      8,84134258




      8,84134258
























          1 Answer
          1






          active

          oldest

          votes


















          1














          valgrind leak search cannot be activated only for 'program normal exits'
          and de-activated for 'crash exits'.



          You might maybe obtain this result by using --vgdb-error=0,
          then (using a script): use gdb+vgdb to connect to the valgrind gdbserver,
          catch the signals you want in gdb, and have gdb killing the process when
          the signal is received: the valgrind gdbserver has a command v.kill that will
          make valgrind exit without doing its usual 'end of life' leak search.






          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53525458%2fvalgrind-suppress-memory-memory-leak-reporting-iff-program-crashed%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            valgrind leak search cannot be activated only for 'program normal exits'
            and de-activated for 'crash exits'.



            You might maybe obtain this result by using --vgdb-error=0,
            then (using a script): use gdb+vgdb to connect to the valgrind gdbserver,
            catch the signals you want in gdb, and have gdb killing the process when
            the signal is received: the valgrind gdbserver has a command v.kill that will
            make valgrind exit without doing its usual 'end of life' leak search.






            share|improve this answer




























              1














              valgrind leak search cannot be activated only for 'program normal exits'
              and de-activated for 'crash exits'.



              You might maybe obtain this result by using --vgdb-error=0,
              then (using a script): use gdb+vgdb to connect to the valgrind gdbserver,
              catch the signals you want in gdb, and have gdb killing the process when
              the signal is received: the valgrind gdbserver has a command v.kill that will
              make valgrind exit without doing its usual 'end of life' leak search.






              share|improve this answer


























                1












                1








                1







                valgrind leak search cannot be activated only for 'program normal exits'
                and de-activated for 'crash exits'.



                You might maybe obtain this result by using --vgdb-error=0,
                then (using a script): use gdb+vgdb to connect to the valgrind gdbserver,
                catch the signals you want in gdb, and have gdb killing the process when
                the signal is received: the valgrind gdbserver has a command v.kill that will
                make valgrind exit without doing its usual 'end of life' leak search.






                share|improve this answer













                valgrind leak search cannot be activated only for 'program normal exits'
                and de-activated for 'crash exits'.



                You might maybe obtain this result by using --vgdb-error=0,
                then (using a script): use gdb+vgdb to connect to the valgrind gdbserver,
                catch the signals you want in gdb, and have gdb killing the process when
                the signal is received: the valgrind gdbserver has a command v.kill that will
                make valgrind exit without doing its usual 'end of life' leak search.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 30 '18 at 0:00









                phdphd

                1,84266




                1,84266
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53525458%2fvalgrind-suppress-memory-memory-leak-reporting-iff-program-crashed%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                    Calculate evaluation metrics using cross_val_predict sklearn

                    Insert data from modal to MySQL (multiple modal on website)