You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
655 B
38 lines
655 B
// |
|
// C++ runtime support not provided by Arduino |
|
// |
|
// Note: use new/delete with caution. The heap is small and |
|
// easily fragmented. |
|
|
|
#include <AP_HAL/AP_HAL.h> |
|
#include <stdlib.h> |
|
|
|
/* |
|
globally override new and delete to ensure that we always start with |
|
zero memory. This ensures consistent behaviour. |
|
*/ |
|
void * operator new(size_t size) |
|
{ |
|
if (size < 1) { |
|
size = 1; |
|
} |
|
return(calloc(size, 1)); |
|
} |
|
|
|
void operator delete(void *p) |
|
{ |
|
if (p) free(p); |
|
} |
|
|
|
void * operator new[](size_t size) |
|
{ |
|
if (size < 1) { |
|
size = 1; |
|
} |
|
return(calloc(size, 1)); |
|
} |
|
|
|
void operator delete[](void * ptr) |
|
{ |
|
if (ptr) free(ptr); |
|
}
|
|
|