Skip to content

Instantly share code, notes, and snippets.

@ValdisB
Forked from jtomschroeder/new_delete.cpp
Created January 29, 2017 05:28
Show Gist options
  • Select an option

  • Save ValdisB/b1475c2ea8a309c082da09eb5b55a02f to your computer and use it in GitHub Desktop.

Select an option

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.
#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