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: Bernard Fouché
Subject: Re: [avr-gcc-list] problem with malloc() in avr-libc 1.6.1
Date: Tue, 29 Jan 2008 18:04:29 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Javier Almansa Sobrino wrote:
The problem is I can't understand the malfuncion of malloc... :-S

Usually malloc() get nuts when you free() a wrong pointer, or you overwrite some bytes just around an allocated area: depending of the implementation of malloc, bytes around the malloc'ed area hold information for malloc() itself (I dunno for avr-libc however). IMHO you should dig more to find your bug, it may not be related directly to malloc(), for instance you may overwrite some area of RAM and, actually, this area holds some data for malloc(). This overwriting may occur during interrupts, or whatever code is activated outside the sample you have posted here.

So changing your memory usage by moving to statically allocated memory may just 'hide the dirt underneath the carpet' :-)

 Bernard




reply via email to

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