On May 25, 9:33 am, Ian Collins <
ian-n...@hotmail.com> wrote:
> On 05/25/12 07:52 PM, gwowen wrote:
>
> > On May 24, 8:19 pm, Ian Collins<
ian-n...@hotmail.com> wrote:
>
> >> I run tests with a custom allocator that can be checked in the test
> >> tearDown. Once in a while (before sharing my changes) I run them in the
> >> debugger with access checking enabled.
>
> > Oh, OK, that makes sense. But unfortunately, the process now starts
> > "First write your custom allocator...".
>
> The last updates on those files were in 2001!
Well, sure, its the perfect candidate for code resuse, but that
doesn't help until you've actually put the legwork in first (even if
it was 11 years ago).
> > I guess the obvious middle-ground is to use the valgrind hooks instead
> > of a custom allocator, and have a unit test in the form of "valgrind
> > run doesn't report any memory leaks".
>
> Assuming Linux, which I don't use....
"Valgrind" here can be considered a placeholder for "widely available
memory leak detector". Purify, maybe. :)
Out of interest, can your custom allocator detect malloc'd pointers
that have been lost (like a GC, say), or just those that are un-free'd
at teardown?