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/mbed_alloc_wrappers.cpp
- Revision:
- 7813:04b3c320bf04
- Parent:
- 7606:dbabbb13e5b0
- Child:
- 7814:9b2b2d58d7dd
--- a/hal/common/mbed_alloc_wrappers.cpp Mon Aug 29 11:07:36 2016 -0500
+++ b/hal/common/mbed_alloc_wrappers.cpp Wed Aug 31 11:46:42 2016 -0600
@@ -46,15 +46,23 @@
uint32_t pad;
} alloc_info_t;
-static SingletonPtr<PlatformMutex> malloc_stats_mutex;
+#ifdef MBED_MEM_TRACING_ENABLED
static SingletonPtr<PlatformMutex> mem_trace_mutex;
+#endif
+#ifdef MBED_HEAP_STATS_ENABLED
+static SingletonPtr<PlatformMutex> malloc_stats_mutex;
static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0};
+#endif
void mbed_stats_heap_get(mbed_stats_heap_t *stats)
{
+#ifdef MBED_HEAP_STATS_ENABLED
malloc_stats_mutex->lock();
memcpy(stats, &heap_stats, sizeof(mbed_stats_heap_t));
malloc_stats_mutex->unlock();
+#else
+ memset(stats, 0, sizeof(mbed_stats_heap_t));
+#endif
}
/******************************************************************************/
@@ -259,12 +267,12 @@
free(ptr);
}
#else // #ifdef MBED_HEAP_STATS_ENABLED
- mem_trace_mutex->lock();
new_ptr = $Super$$realloc(ptr, size);
- mem_trace_mutex->unlock();
#endif // #ifdef MBED_HEAP_STATS_ENABLED
#ifdef MBED_MEM_TRACING_ENABLED
+ mem_trace_mutex->lock();
mbed_mem_trace_realloc(new_ptr, ptr, size, MBED_CALLER_ADDR());
+ mem_trace_mutex->unlock();
#endif // #ifdef MBED_MEM_TRACING_ENABLED
return new_ptr;
}