Created
March 13, 2013 18:02
-
-
Save jtomschroeder/5154598 to your computer and use it in GitHub Desktop.
Arduino new/delete operations: Include these two operator overloads to add new and delete to your Arduino project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
void* operator new(size_t size) | |
{ | |
return malloc(size); | |
} | |
void operator delete(void *ptr) | |
{ | |
if (ptr) | |
free(ptr); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot, Tom,
it's the best I have found in i-net for the year!
In fact, yours decision is only one and the first correct working on my Arduino UNO rev. 3,
but before I tried many others, too unsuccessfully,
I even made the library, replaced Arduino' s standart and tested all the night
creating / deleting new class -es even in the Arduino's basic loop() cycle.
OK, so fare, congratulations!