[PATCH] [v4] malloc: Consistently apply trim_threshold to all heaps [BZ #17195]

Julian Taylor jtaylor.debian@googlemail.com
Wed Feb 18 13:26:00 GMT 2015


On 02/18/2015 11:29 AM, Mel Gorman wrote:

> diff --git a/malloc/arena.c b/malloc/arena.c
> index 886defb074a2..a78d4835a825 100644
> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -696,7 +696,7 @@ heap_trim (heap_info *heap, size_t pad)
>      }
>    top_size = chunksize (top_chunk);
>    extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
> -  if (extra < (long) pagesz)
> +  if (extra < (long) mp_.trim_threshold)
>      return 0;
>  
>    /* Try to shrink. */
> 


I am not very familiar with how the allocator works, what now happens
with this change when you are creating lots of temporary threads that
allocate memory below the trim treshold?
As I understand it each thread has its own arena, as they are now not
trimmed as often anymore is that area memory lost when the thread ends?
I recall something along these lines for the original reasoning why the
trim was not applied to thread arenas.



More information about the Libc-alpha mailing list