[En-Nut-Discussion] Problem with malloc/realloc

Harald Kipp harald.kipp at egnite.de
Thu Apr 26 09:04:36 CEST 2012


Hi Markus,

On 25.04.2012 15:49, Markus Dost wrote:
> I'm using the Ethernut 5-Board with the Nut/OS-version 4.10.2 . In my 
> code I'm using the malloc()- and realloc()-commands from time to time 
> and they're working ... mostly. But it happens, that the program goes to 
> the label "__data_stop" in "crtat91sam9xe512_ram.S" during the 
> allocation and stays there.

There are no known problems with malloc/realloc. If there's not enough memory available (which is most unlikely on Ethernut 5), these functions will not crash but return a NULL pointer. Do they crash inside the function or when using the resulting pointer?

A crash may also be caused by previously overwritten memory areas, which may have corrupted the heap.

This post may be useful:

http://lists.egnite.de/pipermail/en-nut-discussion/2009-April/010751.html

And, of course, the manual:

http://www.ethernut.de/pdf/enswm28e.pdf

Regards,

Harald




More information about the En-Nut-Discussion mailing list