[LCP]memory clobbered before allocated block
Jack Lloyd
lloyd at randombit.net
Mon Apr 5 17:29:02 UTC 2004
The message you're getting is from glibc, and means (basically) that at some
point you're trashing the malloc's internal data structures by writing over
memory that you weren't allocated. Typically malloc stores housekeeping
information just before the memory it that you get back when you call it. If
you destroy the information by, say, writing outside an array boundry, glibc
will (sometimes) detect it and abort.
Things to try:
*) Valgrind (not sure how well it handles threads, I *think* it's OK)
*) MALLOC_CHECK_ (see the malloc man page for details)
*) ElectricFence or other malloc debug libraries (there are plenty)
*) printf and lots of patience
-Jack
On Tue, Mar 30, 2004 at 09:18:08AM -0500, Aaron Walker wrote:
> I am working on my first real project, a lightwight multi threaded http
> server. I have been using siege (a http regression testing/benchmarking
> tool) to test it, and sometimes it'll serve a couple thousand requests
> then dies with:
>
> memory clobbered before allocated block
>
> I tried running in gdb and get the same message with an additional:
>
> Program exited with code 0177.
>
> It seems to work sometimes and then not others. For example, within the
> course of writing this email, I've run it 5 times inside gdb resulting
> in:
>
> run 1: memory clobbered before allocated block (after serving 2100
> requests)
> run 2: run completed (served 137,532 requests)
> run 3: pretty much the same as run 2
> run 4: memory clobbered before allocated block (after 43,395 requests)
> run 5: memory clobbered before allocated block (after 136,644 requests)
>
> Anyone know what these mean? How do I go about figuring out what is
> causing it?
>
> Thanks
> --
> Aaron Walker <ka0ttic at cfl.rr.com>
> http://ka0ttic.dyndns.org/
>
> _______________________________________________
> This is the Linux C Programming List
> : http://lists.linux.org.au/listinfo/linuxcprogramming List
More information about the linuxCprogramming
mailing list