Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: HelloWorld_CCA01M1 HelloWorld_CCA02M1 CI-data-logger-server HelloWorld_CCA02M1 ... more
This is a fork of the events subdirectory of https://github.com/ARMmbed/mbed-os.
Note, you must import this library with import name: events!!!
Diff: hal/common/retarget.cpp
- Revision:
- 7397:7448008aec84
- Parent:
- 7395:79e8c79e165c
- Child:
- 7575:67b11b21d959
- Child:
- 7514:a0c71f3f3d2f
--- a/hal/common/retarget.cpp Wed Aug 03 14:28:53 2016 -0500
+++ b/hal/common/retarget.cpp Mon Aug 01 09:07:35 2016 -0500
@@ -23,6 +23,8 @@
#include "mbed_interface.h"
#include "SingletonPtr.h"
#include "PlatformMutex.h"
+#include "mbed_error.h"
+#include <stdlib.h>
#if DEVICE_STDIO_MESSAGES
#include <stdio.h>
#endif
@@ -724,3 +726,34 @@
#endif
} // namespace mbed
+
+void *operator new(std::size_t count)
+{
+ void *buffer = malloc(count);
+ if (NULL == buffer) {
+ error("Operator new out of memory\r\n");
+ }
+ return buffer;
+}
+
+void *operator new[](std::size_t count)
+{
+ void *buffer = malloc(count);
+ if (NULL == buffer) {
+ error("Operator new[] out of memory\r\n");
+ }
+ return buffer;
+}
+
+void operator delete(void *ptr)
+{
+ if (ptr != NULL) {
+ free(ptr);
+ }
+}
+void operator delete[](void *ptr)
+{
+ if (ptr != NULL) {
+ free(ptr);
+ }
+}