microbit: Added support for MicroBitHeapAllocator to allocate C++ style array
declarations Added missing operator new[] wrapper in MicroBitHeapAllocator.h Ammended defualt microBitConfig.h to allocate 90% of available heap, rather than 95%. this is to leave a little more heap for external libraries.master
parent
6916d506b8
commit
92905593f1
|
@ -39,7 +39,7 @@
|
|||
|
||||
// The proportion of SRAM available on the mbed heap to reserve for the micro:bit heap.
|
||||
#ifndef MICROBIT_HEAP_SIZE
|
||||
#define MICROBIT_HEAP_SIZE 0.25
|
||||
#define MICROBIT_HEAP_SIZE 0.9
|
||||
#endif
|
||||
|
||||
// if defined, reuse the 8K of SRAM reserved for SoftDevice (Nordic's memory resident BLE stack) as heap memory.
|
||||
|
|
|
@ -91,6 +91,14 @@ inline void* operator new(size_t size) throw(std::bad_alloc)
|
|||
return microbit_malloc(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the 'new' operator globally, and redirects calls to the micro:bit theap allocator.
|
||||
*/
|
||||
inline void* operator new[](size_t size) throw(std::bad_alloc)
|
||||
{
|
||||
return microbit_malloc(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the 'delete' operator globally, and redirects calls to the micro:bit theap allocator.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue