Dynamic allocation of memory


i have been looking bit "__malloc_heap_end" lately, , think there might me way malloc memory (responsibly).

if curious , wants me this, start reading http://www.nongnu.org/avr-libc/user-manual/malloc.html.

especially bit:
"if __malloc_heap_end 0, allocator attempts detect bottom of stack in order prevent stack-heap collision when extending actual size of heap gain more space dynamic memory"

if has done research on matter, please feel free post knowledge!

hi invalidapple

i've been looking heap management quite bit. i'll jump right in if that's ok. can start asking mean by
quote
there might me way malloc memory (responsibly)


the reason ask can't see problem malloc. far i've looked, seems job both of not corrupting stack (if it's used correctly) , of managing freelist efficiently. (i havn't yet looked @ realloc).

where see problem stack doesn't appear show same courtesy , respect heap.

with regards __malloc_heap_end, seems fine too. appears used both flag (zero) heap in sram , "high water mark" if heap has been moved external ram (talking atmega here rather arduino specifically). arduino it's correctly set 0 informing heap handler heap in sram , therefore below stack , therefore needs take sp account when allocation extend heap. in case of atmega external ram, if decided move heap there, __malloc_heap_end set upper limit wanted use heap , watched instead of sp.

i have vague un-thought-out idea @ moment of perhaps enhancing stack push routine checks heap collision. problem i'm thinking though is: if avoid corrupting heap? what's going do? in larger system you'd "stack overflow" error. on arduino? - anyway - said - vague thought @ moment.



Arduino Forum > Forum 2005-2010 (read only) > Software > Development > Dynamic allocation of memory


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums