Re: Trim the heap free memory - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Trim the heap free memory
Date
Msg-id 953078.1726424534@sss.pgh.pa.us
Whole thread Raw
In response to Re: Trim the heap free memory  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: Trim the heap free memory
List pgsql-hackers
shawn wang <shawn.wang.pg@gmail.com> writes:
> I have successfully registered my patch for the commitfest. However, upon
> integration, I encountered several errors during the testing phase. I am
> currently investigating the root causes of these issues and will work on
> providing the necessary fixes.

I should think the root cause is pretty obvious: malloc_trim() is
a glibc-ism.

I'm fairly doubtful that this is something we should spend time on.
It can never work on any non-glibc platform.  Even granting that
a Linux-only feature could be worth having, I'm really doubtful
that our memory allocation patterns are such that malloc_trim()
could be expected to free a useful amount of memory mid-query.
The single test case you showed suggested that maybe we could
usefully prod glibc to free memory at query completion, but we
don't need all this interrupt infrastructure to do that.  I think
we could likely get 95% of the benefit with about a five-line
patch.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Wolfgang Walther
Date:
Subject: Re: Regression tests fail with tzdata 2024b
Next
From: Tom Lane
Date:
Subject: Re: how to speed up 002_pg_upgrade.pl and 025_stream_regress.pl under valgrind