diff options
-rw-r--r-- | docs/Doxyfile | 2 | ||||
-rw-r--r-- | docs/ch.txt | 32 | ||||
-rw-r--r-- | src/chheap.c | 4 | ||||
-rw-r--r-- | src/chmempools.c | 5 |
4 files changed, 40 insertions, 3 deletions
diff --git a/docs/Doxyfile b/docs/Doxyfile index 7f4432c52..4df239ac5 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -255,6 +255,8 @@ PREDEFINED = __JUST_STUBS__ \ CH_USE_QUEUES_HALFDUPLEX \ CH_USE_SERIAL_FULLDUPLEX \ CH_USE_SERIAL_HALFDUPLEX \ + CH_USE_HEAP \ + CH_USE_MEMPOOLS \ CH_USE_MESSAGES \ CH_USE_MESSAGES_EVENT \ CH_USE_MESSAGES_PRIORITY \ diff --git a/docs/ch.txt b/docs/ch.txt index a88291bb2..307dc6765 100644 --- a/docs/ch.txt +++ b/docs/ch.txt @@ -345,6 +345,38 @@ /** @} */
/**
+ * @defgroup Heap Heap
+ * @{
+ * Heap Allocator related APIs.
+ * <b>Operation mode</b><br><br>
+ * The heap allocator implements a first-fit strategy and its APIs are
+ * functionally equivalent to the usual \p malloc() and \p free(). The main
+ * difference is that the heap APIs are thread safe.<br>
+ * By enabling the \p CH_USE_MALLOC_HEAP option the heap manager will use the
+ * runtime-provided \p malloc() and \p free() as backend for the heap APIs
+ * instead of the system provided allocator.<br>
+ * In order to use the heap APIs the \p CH_USE_HEAP option must be specified
+ * in \p chconf.h.
+ * @file include/heap.h Heap macros and structures.
+ * @file chheap.c Heap functions.
+ */
+/** @} */
+
+/**
+ * @defgroup MemoryPools Memory Pools
+ * @{
+ * Memory Pools related APIs.
+ * <b>Operation mode</b><br><br>
+ * The Memory Pools APIs allow to allocate/free fixed size objects in
+ * <b>constant time</b> and reliably without memory fragmentation problems.<br>
+ * In order to use the Time APIs the \p CH_USE_MEMPOOLS option must be
+ * specified in \p chconf.h.
+ * @file include/mempools.h Memory Pools macros and structures.
+ * @file chmempools.c Memory Pools functions.
+ */
+/** @} */
+
+/**
* @defgroup Semaphores Semaphores
* @{
* Semaphores and threads synchronization.
diff --git a/src/chheap.c b/src/chheap.c index 0cda7f268..f4c80314d 100644 --- a/src/chheap.c +++ b/src/chheap.c @@ -18,7 +18,7 @@ */
/**
- * @addtogroup Memory
+ * @addtogroup Heap
* @{
*/
@@ -251,3 +251,5 @@ bool_t chHeapNotFragmented(void) { #endif /* CH_USE_MALLOC_HEAP */
#endif /* CH_USE_HEAP */
+
+/** @} */
diff --git a/src/chmempools.c b/src/chmempools.c index 49020d9b2..ae726122b 100644 --- a/src/chmempools.c +++ b/src/chmempools.c @@ -102,9 +102,10 @@ void chPoolFree(MemoryPool *mp, void *objp) { * of objects.
*/
void chPoolRelease(MemoryPool *mp) {
+ void *p;
- while (mp->mp_next)
- chHeapFree(mp->mp_next);
+ while ((p = chPoolAlloc(mp, FALSE)) != NULL)
+ chHeapFree(p);
}
#endif
|