Skip to content

Commit 011370f

Browse files
committed
Added new/delete stubs for Arduino Due
Fix arduino#1485 A better implementation may be desirable as discussed in arduino#108
1 parent d8a632f commit 011370f

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

cores/arduino/new.cpp

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright (c) 2014 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#include <stdlib.h>
20+
21+
void *operator new(size_t size) {
22+
return malloc(size);
23+
}
24+
25+
void *operator new[](size_t size) {
26+
return malloc(size);
27+
}
28+
29+
void operator delete(void * ptr) {
30+
free(ptr);
31+
}
32+
33+
void operator delete[](void * ptr) {
34+
free(ptr);
35+
}
36+

0 commit comments

Comments
 (0)