Heap space using LD

Dear everybody,

I'm wondering about a problem allocating an object with the "new" operator using the NIOS development tools. I think my problem is not strictly related to the NIOS environment but at the usage of the LD tool.

I have defined a simple memory map for my project. The linker script defines the .text section, the .data section and the .bss section. At the end of the .bss section I have defined the variable "_end" which should be used by the linker to define the start of the mallocable area (heap). Well, at startup my software builds some objects and they are correctly allocated after the memory location defined by the content of "_end" (the mallocable area). But, when the software tries to allocate the biggest object I need, the "new" operator allocates it before the memory location limited by the content of "_end".

I don't really understand what happens, because:

1) if there is no more space to allocate the object the "new" operator should return a pointer to 0. (Or not ?)

2) the size of mallocable area I have reserved is large enaugh to hold all of objects of my software

Where is the mistake ?

After some tests I can say that LD assigns 4KB to the heap size of my application nevertheless I have much more memory. Is there a parameter which informs LD about the size of the heap ?

Best Regards


Reply to
Alessandro Strazzero
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.