Created
November 6, 2012 03:15
-
-
Save kinoshita-lab/4022337 to your computer and use it in GitHub Desktop.
arduino operator new
This file contains 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 <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