-
-
Save ValdisB/b1475c2ea8a309c082da09eb5b55a02f 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