diff options
| author | Bernard Xiong <[email protected]> | 2021-09-27 14:16:17 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-09-27 14:16:17 +0800 |
| commit | 173913b96ef80c3b9f1b3d0d7b7318985902a6fe (patch) | |
| tree | 70c243fbe2d8a0dff07078853f75617fbab511a7 /src | |
| parent | 2be76213309e1a46b84ce33a97fb586d3637fd18 (diff) | |
| parent | 2e5b4736fe86e852c218d9ed0e492ba9ea6a3d56 (diff) | |
Merge pull request #4872 from aozima/aozima_memheap_develop
优化memheap内存管理:1.自动多块粘合可配置;
Diffstat (limited to 'src')
| -rw-r--r-- | src/Kconfig | 15 | ||||
| -rw-r--r-- | src/memheap.c | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/Kconfig b/src/Kconfig index 71abd9cf4f..fc7fcd54f4 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 f9da3ac015..68a15d1a8e 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) |
