Merge pull request #4872 from aozima/aozima_memheap_develop
优化memheap内存管理:1.自动多块粘合可配置;
This commit is contained in:
commit
173913b96e
15
src/Kconfig
15
src/Kconfig
|
@ -268,11 +268,18 @@ menu "Memory Management"
|
||||||
help
|
help
|
||||||
Using static memory fixed partition
|
Using static memory fixed partition
|
||||||
|
|
||||||
config RT_USING_MEMHEAP
|
menuconfig RT_USING_MEMHEAP
|
||||||
bool "Using memory heap object"
|
bool "Using memory heap object"
|
||||||
default n
|
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
|
choice
|
||||||
prompt "Dynamic Memory Management"
|
prompt "Dynamic Memory Management"
|
||||||
|
@ -289,7 +296,7 @@ menu "Memory Management"
|
||||||
|
|
||||||
if RT_USING_MEMHEAP
|
if RT_USING_MEMHEAP
|
||||||
config RT_USING_MEMHEAP_AS_HEAP
|
config RT_USING_MEMHEAP_AS_HEAP
|
||||||
bool "Use all of memheap objects as heap"
|
bool "Use memheap objects as heap"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
config RT_USING_USERHEAP
|
config RT_USING_USERHEAP
|
||||||
|
|
|
@ -852,6 +852,7 @@ void *rt_malloc(rt_size_t size)
|
||||||
|
|
||||||
/* try to allocate in system heap */
|
/* try to allocate in system heap */
|
||||||
ptr = rt_memheap_alloc(&_heap, size);
|
ptr = rt_memheap_alloc(&_heap, size);
|
||||||
|
#ifdef RT_USING_MEMHEAP_AUTO_BINDING
|
||||||
if (ptr == RT_NULL)
|
if (ptr == RT_NULL)
|
||||||
{
|
{
|
||||||
struct rt_object *object;
|
struct rt_object *object;
|
||||||
|
@ -881,6 +882,7 @@ void *rt_malloc(rt_size_t size)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* RT_USING_MEMHEAP_AUTO_BINDING */
|
||||||
|
|
||||||
#ifdef RT_USING_MEMTRACE
|
#ifdef RT_USING_MEMTRACE
|
||||||
if (ptr == RT_NULL)
|
if (ptr == RT_NULL)
|
||||||
|
|
Loading…
Reference in New Issue