begin  quoting James G. Sack (jim) as of Sat, Sep 30, 2006 at 03:28:35PM -0700:
[snip]
> OK, I tried mtrace. Unless there's some undocumented features somewhere,
> it seems fairly simple minded. It reports unfreed allocations, but not
> write-past end-of-allocation.

Still not enough control to flush the error in my code. :-/

>                               I'm not sure what else it might handle. It
> actually seems to hang on a double free.

Ow.

Just to avoid the problems of a double-free, I pondered asking for a
pointer to a pointer to a CircBuf.  That way I could _set_ the pointer
in the _Delete to NULL, and the _Create could check the pointer and do
a _Delete if it wasn't null.

But that seemed like a lot of overhead that I'd have to debug first,
just to let the programmer be a little more sloppy.  In a production
library, maybe, but then, there's always the risk of adding so much
clever junk that you obscure what the code is actually doing.

[snip]
> It's provided as memwatch.c and memwatch.h (which seems to need
> inclusion after other headers -- at least, I had a compile error
> reported from string.h if memwatch.h preceded other stuff including
> string.h)

I looked at the source, and I've discovered it uses one of the ugliest
brace styles ever:

  if( expression){
     code;
     }

<shudder> <horrors> <insanity>

More significantly, I failed to see where the 'trick' was that I want
to emulate. I'm still thinking that the malloc_hook is the goat's bannanas,
but then, that ties the test code into GNU-land, which means it's no
longer portable. :(

> Anyway it seems worth working with, maybe even making into a library
> module, although explicit linking is easy emough.
 
I'm leery of conditional-compilation for testing; the code that you end
up running in the test isn't the code that you use in production.

> There is a test.c example program as well as decent README.
> 
> _memwatch looks good_
>   http://www.linkdata.se/sourcecode.html

It's overkill for our little bit of code.  :-/

-- 
_ |\_
 \|

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to