diff options
author | Chris Johns <chrisj@rtems.org> | 2021-02-08 17:27:34 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2021-02-08 17:45:52 +1100 |
commit | 7ca3b283bac78e69f09f6e0e992abf088e7dd16c (patch) | |
tree | dcaa9fe46d8dddba7f4c91ebc212e1e94a71c67e /cpukit/libcsupport | |
parent | libcsupport: Add no_regular_file_mknod as a mount option to the mount table (diff) | |
download | rtems-7ca3b283bac78e69f09f6e0e992abf088e7dd16c.tar.bz2 |
libcsupport: Have greedy allocations use consume extended memory
- Call the heap extend handler until all memory has been
requested.
Closes #3982
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/src/rtems_heap_greedy.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/rtems_heap_greedy.c b/cpukit/libcsupport/src/rtems_heap_greedy.c index 4dda39873f..c02e48d962 100644 --- a/cpukit/libcsupport/src/rtems_heap_greedy.c +++ b/cpukit/libcsupport/src/rtems_heap_greedy.c @@ -30,8 +30,21 @@ void *rtems_heap_greedy_allocate( size_t block_count ) { + Heap_Control *heap = RTEMS_Malloc_Heap; + size_t size = 128 * 1024 * 1024; void *opaque; + while ( size > 0 ) { + opaque = (*rtems_malloc_extend_handler)( heap, size ); + if ( opaque == NULL ) { + size >>= 1; + } else { + if ( rtems_malloc_dirty_helper != NULL ) { + (*rtems_malloc_dirty_helper)( opaque, size ); + } + } + } + _RTEMS_Lock_allocator(); opaque = _Heap_Greedy_allocate( RTEMS_Malloc_Heap, block_sizes, block_count ); _RTEMS_Unlock_allocator(); |