Re: Sort memory not being released - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Sort memory not being released
Date
Msg-id 20030618001853.GC729@svana.org
Whole thread Raw
In response to Re: Sort memory not being released  (Sean Chittenden <sean@chittenden.org>)
List 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@svana.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

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: EFFECTIVE_CACHE_SIZE
Next
From: Ursula Lee
Date:
Subject: How to convert Oracle database to Postgresql.