David Smart
/
mbed_blinky_eats_memory
Revised test using private new/delete methods suggested in http://mbed.org/forum/mbed/post/24686/
Diff: Utility.cpp
- Revision:
- 0:63f4520f2953
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Utility.cpp Wed Jun 11 10:59:02 2014 +0000 @@ -0,0 +1,22 @@ + +#include "Utility.h" + +uint32_t Free() { + uint32_t max = 50000; + uint32_t x = max / 2; + uint32_t min = 0; + + __disable_irq(); + while (min < max-1) { + void * p = malloc(x); + if (p) { + free(p); + min = x; + } else { + max = x; + } + x = (max + min)/2; + } + __enable_irq(); + return(x); +} \ No newline at end of file