Re: Limiting memory allocation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Limiting memory allocation
Date
Msg-id 1629012.1652825511@sss.pgh.pa.us
Whole thread Raw
In response to Re: Limiting memory allocation  (Jan Wieck <jan@wi3ck.info>)
Responses Re: Limiting memory allocation
List pgsql-hackers
Jan Wieck <jan@wi3ck.info> writes:
> On 5/17/22 15:42, Stephen Frost wrote:
>> Thoughts?

> Using cgroups one can actually force a certain process (or user, or 
> service) to use swap if and when that service is using more memory than 
> it was "expected" to use.

I wonder if we shouldn't just provide documentation pointing to OS-level
facilities like that one.  The kernel has a pretty trivial way to check
the total memory used by a process.  We don't: it'd require tracking total
space used in all our memory contexts, and then extracting some number out
of our rear ends for allocations made directly from malloc.  In short,
anything we do here will be slow and unreliable, unless you want to depend
on platform-specific things like looking at /proc/self/maps.

ulimit might be interesting to check into as well.  The last time I
looked, it wasn't too helpful for this on Linux, but that was years ago.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Zstandard support for toast compression
Next
From: Stephen Frost
Date:
Subject: Re: Limiting memory allocation