As you already got good answers to most of your questions, I will try to cover here only this one:
Is it possible to quantify the fragmentation and get a feel of what's safe safe and when it becomes risky?
A quick Web search for “arduino“Arduino free memory” finds a few code snippets that can be used to measure, at run time, the amount of free memory:
Available Memory, in the Arduino Playground, only works on AVR. It measures the total amount of available RAM, including the holes in the heap.
Measuring Memory Usage, an Adafruit tutorial, shows some portable (AVR and ARM) code that measures the available RAM between the heap and the stack. This does not include the holes in the heap.
If you compare the AVR versions of these two code snippets, you can see
the difference is in the freeListSize()
function of the PalygroundPlayground
version. This function returns the total memory residing in heap holes,
which could be a measure of the heap fragmentation.
The function is AVR-specific, but then AVR is where heap fragmentation is most worrisome.