EmbDev.net

Forum: ARM programming with GCC/GNU tools Problem with NewLib 1.18.0 in Yagarto 23-12-09


von Jason M. (Company: VPN Solutions Ltd) (the-moog)


Rate this post
useful
not useful
I have discovered a problem with Newlib 1.18.0 in the release of Yagarto 
23-12-09.

When printf'ing floats it calls Balloc in function dtoa in mprec.c, this 
allocates memory for the structures that are used during the formatting.

For some reason it calls spbrk asking for about 1G of memory. Obviously 
this fails on my system with only 32k.

Reverting to Newlib 1.17.0 resolves this problem.

I barely understand what the code is doing, but I can see that the 
variable k is the cause.   It shifts a 32 bit unsigned int of value 1 by 
k bits,  k is 28 so this becomes a very large number indeed, it then 
multiplies this by the size of a long and calls malloc.  Obviouly malloc 
needs more memory to handle this so calls spbrk.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.