Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Question about leak_search [on|off] in .psrc configuration

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in Insure++
Insure++ configuration
Hi

We run insure++ for memory leak checking in the following environment:

OS : Linux 2.4.21-4.ELsmp #1 SMP
Compiler : gcc 3.4.6
Insure++ : 7.1.6

We are confused as to what the option leak_search is doing internally. Having looked at this post
http://forums.parasoft.com/lofiversion/index.php/t130.html
we are under the impression that leak_search on prevents false positives from flooding the report.
On the contrary, turning this option off makes all the leaks/problems dissappear.
Specifically with leak_search on, we get lots of leaks detected during execution in the Memory leak summary.
These runtime leaks are marked as bogus in the Problem summary. Besides those we get a lot of LEAK_ASSIGN
type of errors.

Is there some trick related to the use of leak_search i.e. another configuration option to be used on the same time ?
What is the extra internal checks performed as a result of setting leak_search on ? Should these checks report leaks that would
otherwise be missed ?

Thanks in advance
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited December 2016
    Hi,

    leak_search is only useful in the presence of uninstrumented code.

    consider the following code:


    void foo(void *); // uninstrumented function void zork() { void *p = malloc(10); foo(p); } // possible LEAK_SCOPE here


    Now, Insure++ has no way of knowing from this code at compile time what function foo() is going to do with the pointer p. It could save the pointer in some memory structure, it could free the memory, etc. Let's assume for the sake of demonstration that foo() saves the pointer somewhere. Since foo() has not been instrumented, Insure++ has no way of knowing that the pointer has been saved somewhere. So, it performs a leak_search, which looks for the pointer value in the stack, global memory and the heap. If it finds the pointer value, it doesn't issue a LEAK_SCOPE. If it doesn't find the value, it does issue the LEAK_SCOPE.

    As you might imagine, the leak_search is a CPU intensive process, so turning off leak_search help speed things up. There is, however, a cost.

    Since Insure++ cannot issue the LEAK_SCOPE if leak_search is off, you might miss an actual legitimate leak event. However, you can reliably find such events in the leak summary report if you turn that option on. (summarize leaks in your .psrc option file, or for windows, turn on the leak summary report in the insure control panel).

    Kind Regards,
    --Rich
    Insure++ Principal Software Engineer