avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] problem with malloc() in avr-libc 1.6.1


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] problem with malloc() in avr-libc 1.6.1
Date: Tue, 29 Jan 2008 21:20:44 +0100 (MET)

(For whatever odd reason, I don't have a copy of Javier's original
message to follow up onto, so I'm using David's mail for the
followup.)

> Javier Almansa Sobrino wrote:

>> My program runs ok for a time, later it crashes. I've debugged it
>> with avarice and ddd and I've noticed the function before commented
>> runs ok for 5 or 6 times, later, when I call the malloc function
>> this call to malloc never returns. Debugging the code, I've seen
>> the program never end the step two of the malloc function.

That could only happen if the free list becomes cyclically linked.
You could trace that in the debugger by following the pointer __flp,
and all its ->nx members.

If that happens reproducibly in your environment, and you made
reasonably sure it's not due to memory corruption (which could e.g.
also happen by later on modifying the contents of an area that has
already been free()ed), I'd be most interested in getting a complete
trace of the individual allocations and deallocations.  I don't have
an idea about your environment, but perhaps it would be possible to
add debugging printf()s to (local copies of) malloc() and free() upon
entering these functions, e.g. to some RS-232 interface?

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

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