[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make "make check" abort on memory leaks or errors

From: Simon Newton
Subject: Re: Make "make check" abort on memory leaks or errors
Date: Tue, 8 Jul 2014 18:33:52 -0700

On Tue, Jul 8, 2014 at 8:04 AM, Steffen Dettmer
<address@hidden> wrote:
> Hi,
> I have s small C++ test project using autoconf, automake and CppUnit.
> I like to check for memory errors, starting with memory leaks.
> I started with "./configure CXXFLAGS=-fsanitize=address", which
> detects some memory errors (e.g. use-after-delete), but no memory
> leaks.
> After searching the web for a while, I thougt to fall-back to valgrind
> using "make check TESTS_ENVIRONMENT=valgrind". Althrough "valgrind
> ./mytestrunner" works (test program aborts because of memory leak),
> "make check TESTS_ENVIRONMENT=valgrind" does not work, it errnously
> returns status 0, no memory errors are reported. Maybe valgrind
> checked the automatically generated automake "test-driver" script for
> memory leaks?
> Since I assume checking memory usage errors is a coomon requirement, I
> think there could be a common solution, but I failed to find it. Could
> anyone please advice how to check for memory leaks?
> A pragma solution specific/limited to g++ (4.8) on Linux (e.g. Lubuntu
> 14.04) without libtool would be sufficient.

I use tcmalloc to detect leaks. Our ./configure has a
--enable-tc-malloc which sets -ltcmalloc and then you just need to add
HEAPCHECK=normal .


> Regards,
> Steffen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]