malloc.c - why?

Hello. As a programming novice I'm trying to stitch together all these GCC-ish things out there - binutils, make, gcc itself. Then there are the various windows binaries for microcontrollers, WinAVR, GNU ARM etc.. So my question at the moment is, why does the Arduino IDE compile malloc.c (in the hardware/arduino/cores/arduino/avr-libc/ directory) when compiling a program? I don't see malloc.c anywhere in WinAVR or AVR LibC for that matter, so why is it there? (And I think the remaining 3 header/C files in the same avr-libc folder also aren't part of WinAVR nor AVR LibC. What's going on??

malloc() is used by the C++ String library. In avr-libc, it's part of stdlib: http://www.nongnu.org/avr-libc/user-manual/group__avr__stdlib.html Except that I think the version of avr-libc normally included with Arduino is older and has a broken malloc() implementation, so they explicitly added a newer/fixed version to be used instead.

fez79: so why is it there?

In case you need do a malloc?

For example, the Standard Template Library uses it, plus other things like the SD library.