[PATCH] libcsupport: Have greedy allocations use consume extended memory

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 8 06:38:15 UTC 2021


On 08/02/2021 07:30, chrisj at rtems.org wrote:
> diff --git a/cpukit/libcsupport/src/rtems_heap_greedy.c b/cpukit/libcsupport/src/rtems_heap_greedy.c
> index 4dda39873f..2361f17d2e 100644
> --- a/cpukit/libcsupport/src/rtems_heap_greedy.c
> +++ b/cpukit/libcsupport/src/rtems_heap_greedy.c
> @@ -30,8 +30,20 @@ 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 );
> +    }
> +  }
You need a couple of more ' ' after and before the braces. Each if 
should have a { }. Apart from the formatting it looks good.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list