Skip to content

Instantly share code, notes, and snippets.

@kinoshita-lab
Created November 6, 2012 03:15
Show Gist options
  • Save kinoshita-lab/4022337 to your computer and use it in GitHub Desktop.
Save kinoshita-lab/4022337 to your computer and use it in GitHub Desktop.
arduino operator new
#include <stdint.h>
#include <string.h>
void* operator new[](size_t size)
{
return malloc(size);
}
static const uint32_t dekaiSize = 64 *1024 * 1024;
char* dekaiArray = 0;
void setup()
{
Serial.begin(38400);
dekaiArray = new char[dekaiSize];
}
void loop()
{
static int i = 0;
dekaiArray[dekaiSize - 1] = i;
i++;
Serial.println(static_cast<int>(dekaiArray[dekaiSize - 1]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment