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:
- 7395:79e8c79e165c
- Parent:
- 7338:b24a223c149b
- Child:
- 7397:7448008aec84
diff -r 142e584d7a58 -r 79e8c79e165c hal/common/retarget.cpp
--- a/hal/common/retarget.cpp Tue Aug 09 14:28:21 2016 +0100
+++ b/hal/common/retarget.cpp Fri Jul 29 15:29:56 2016 -0500
@@ -68,6 +68,10 @@
extern const char __stderr_name[] = "/stderr";
#endif
+// Heap limits - only used if set
+unsigned char *mbed_heap_start = 0;
+uint32_t mbed_heap_size = 0;
+
/* newlib has the filehandle field in the FILE struct as a short, so
* we can't just return a Filehandle* from _open and instead have to
* put it in a filehandles array and return the index into that array
@@ -596,6 +600,12 @@
return (caddr_t)-1;
}
+ // Additional heap checking if set
+ if (mbed_heap_size && (new_heap >= mbed_heap_start + mbed_heap_size)) {
+ errno = ENOMEM;
+ return (caddr_t)-1;
+ }
+
heap = new_heap;
return (caddr_t) prev_heap;
}