This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

malloc() never returns


Hi,

i use newlib-1.14 for V850E.

In the simulator (insight-weekly-6.5-50) i found out that
when i do a malloc(1024) as a first step in main() the
program flow goes to:

malloc(1024)
_malloc_r(_REENT, 1024)
...
mALLOc(RARG size_t bytes)

In there it hangs in the for() at 2392:

for (victim = last(bin); victim != bin; victim = victim->bk)
{
...
}
In the simulator i see that victim is 0x0 and victim->bk is
also 0x0.

What could i have done wrong to make this fail?

What is strange is that i have set a breakpoint on sbrk(), which
does not seem to get called before this infinite loop.


In my own startup code i do:
- set up stack, ep, gp, ctbp, r20 and r21
- clear .bss
- copy from ROM: .zdata, .sdata and .data

Is there anything missing?


Best regards,
Torsten.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]