Re: Sort memory not being released

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sort memory not being released
Date: 2003-06-18 00:18:53
Message-ID: 20030618001853.GC729@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 17, 2003 at 10:02:07AM -0700, Sean Chittenden wrote:
> For long running servers and processes that grow quite large when
> processing something, but you'd like to have a small foot print when
> not processing data, this is what I have to do as a chump defrag
> routine. Works well for platforms that have a halfway decent
> malloc(). Another option is to mmap() private anonymous regions,
> though I haven't don this for anything huge yet as someone reported
> being able to mmap() less than they were able to malloc()... something
> I need to test.

Look at the process memory layout. On Linux you get stack+heap is limited to
2GB. To access the rest you need to mmap(). This would vary depending on the
OS. IMHO glibc's approach (use mmap() for large allocations) is a good one
since the sortmems will generally be mmap()ed (at least they were in my
quick test last night.

As Tom pointed out, some study into memory framentation would be useful.

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
> - Samuel P. Huntington

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ursula Lee 2003-06-18 02:16:44 How to convert Oracle database to Postgresql.
Previous Message Tom Lane 2003-06-18 00:13:24 Re: EFFECTIVE_CACHE_SIZE