Louis B. (ldb) wrote On 02/05/07 10:18,:
> I have a long running program that eventually crashes when valloc()
> returns a 0. [...]
Others have pointed out that this isn't a C question.
However, one possible source of confusion may be a C
mistake:
> struct mallinfo mi;
> [...]
> mi = mallinfo();
> printf("hblks : %d hblkshd : %d\n", mi.hblks, mi.hblkhd);
There's no `struct mallinfo' in Standard C, but on the
box I'm using at the moment all the members of that struct
are of type `unsigned long'. If that's true of your machine,
too, then you're printing them with the wrong format specifier:
"%d" requires a corresponding `(signed) int' argument, not an
`unsigned long'. Turn up your warning levels, and fix what
the compiler complains about.
That might not cure what ails you -- but when you're faced
with a mystery, it's always a good policy to get your code into
squeaky-clean condition before concluding that you've found a
bug.
--