Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you're running on Linux, you could run your tests with <a href="http://valgrind.org/docs/manual/quick-start.html#quick-start.mcrun" rel="nofollow noreferrer">memcheck</a>.</p> <p>The <a href="http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs" rel="nofollow noreferrer">Client Requests</a> section of the manual describes several useful macros, of which one is noted as being useful for testing:</p> <blockquote> <p><code>VALGRIND_COUNT_LEAKS</code>: fills in the four arguments with the number of bytes of memory found by the previous leak check to be leaked, dubious, reachable and suppressed. Again, useful in test harness code, after calling <code>VALGRIND_DO_LEAK_CHECK</code>.</p> </blockquote> <p>The macro is defined in <code>memcheck.h</code> (likely in <code>/usr/include/valgrind</code>), and the sequence you want will resemble</p> <pre><code>unsigned long base_definite, base_dubious, base_reachable, base_suppressed; VALGRIND_DO_LEAK_CHECK; VALGRIND_COUNT_LEAKS(base_definite, base_dubious, base_reachable, base_suppressed); // maybe assert that they're zero! // call test unsigned long leaked, dubious, reachable, suppressed; VALGRIND_DO_LEAK_CHECK; VALGRIND_COUNT_LEAKS(leaked, dubious, reachable, suppressed); CPPUNIT_ASSERT_EQUAL(base_leaked, leaked); // etc. </code></pre> <p>Repeating that for every test would be a pain, so you might write macros of your own or, even better, a specialized <a href="http://cppunit.sourceforge.net/doc/lastest/class_test_runner.html" rel="nofollow noreferrer">TestRunner</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload