Skip to content

Commit 2e5b473

Browse files
committed
[kernel] update memheap auto binding policy.
1 parent 00221bd commit 2e5b473

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Kconfig

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,18 @@ menu "Memory Management"
268268
help
269269
Using static memory fixed partition
270270

271-
config RT_USING_MEMHEAP
271+
menuconfig RT_USING_MEMHEAP
272272
bool "Using memory heap object"
273273
default n
274-
help
275-
Using memory heap object to manage dynamic memory heap.
274+
275+
if RT_USING_MEMHEAP
276+
277+
if RT_USING_MEMHEAP_AS_HEAP
278+
config RT_USING_MEMHEAP_AUTO_BINDING
279+
bool "Use all of memheap objects as heap"
280+
default y
281+
endif
282+
endif
276283

277284
choice
278285
prompt "Dynamic Memory Management"
@@ -289,7 +296,7 @@ menu "Memory Management"
289296

290297
if RT_USING_MEMHEAP
291298
config RT_USING_MEMHEAP_AS_HEAP
292-
bool "Use all of memheap objects as heap"
299+
bool "Use memheap objects as heap"
293300
endif
294301

295302
config RT_USING_USERHEAP

src/memheap.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,7 @@ void *rt_malloc(rt_size_t size)
852852

853853
/* try to allocate in system heap */
854854
ptr = rt_memheap_alloc(&_heap, size);
855+
#ifdef RT_USING_MEMHEAP_AUTO_BINDING
855856
if (ptr == RT_NULL)
856857
{
857858
struct rt_object *object;
@@ -881,6 +882,7 @@ void *rt_malloc(rt_size_t size)
881882
break;
882883
}
883884
}
885+
#endif /* RT_USING_MEMHEAP_AUTO_BINDING */
884886

885887
#ifdef RT_USING_MEMTRACE
886888
if (ptr == RT_NULL)

0 commit comments

Comments
 (0)