diff --git a/src/Kconfig b/src/Kconfig index 71abd9cf4f5bc8992433faf772c10ae545213405..fc7fcd54f4381d50e7f4b9768c6ca3d3da4cec29 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -268,11 +268,18 @@ menu "Memory Management" help Using static memory fixed partition - config RT_USING_MEMHEAP + menuconfig RT_USING_MEMHEAP bool "Using memory heap object" default n - help - Using memory heap object to manage dynamic memory heap. + + if RT_USING_MEMHEAP + + if RT_USING_MEMHEAP_AS_HEAP + config RT_USING_MEMHEAP_AUTO_BINDING + bool "Use all of memheap objects as heap" + default y + endif + endif choice prompt "Dynamic Memory Management" @@ -289,7 +296,7 @@ menu "Memory Management" if RT_USING_MEMHEAP config RT_USING_MEMHEAP_AS_HEAP - bool "Use all of memheap objects as heap" + bool "Use memheap objects as heap" endif config RT_USING_USERHEAP diff --git a/src/memheap.c b/src/memheap.c index 8422b1d802cb5752b47f9123a4cd33fad99e3b06..d1c282292287b05daf4ae4018979916171ef1257 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -852,6 +852,7 @@ void *rt_malloc(rt_size_t size) /* try to allocate in system heap */ ptr = rt_memheap_alloc(&_heap, size); +#ifdef RT_USING_MEMHEAP_AUTO_BINDING if (ptr == RT_NULL) { struct rt_object *object; @@ -881,6 +882,7 @@ void *rt_malloc(rt_size_t size) break; } } +#endif /* RT_USING_MEMHEAP_AUTO_BINDING */ #ifdef RT_USING_MEMTRACE if (ptr == RT_NULL)