Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

the function malloc( )

hello

Now ,I know the function malloc() can be used to build a dynamic memory .But I am not sure that

the dynamic memory takes up the onchiop memory if I only use the onchip memory not the periphery sram.

where the dynamic memory is in ,onchip memory or periphery sram ?

Thank you !

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The memory space which malloc() allocated memory from is called the heap.

    By default this is located immediately after your BSS section (which goes in the memory specified as rwdata in the GUI) and continues until it gets to the end of the memory or until it reaches the stack.

    If you want more information then please look in the altera_hal source code for the the function sbrk() which is what malloc() uses to get more memory to allocate.