Re: Limiting memory allocation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <jan(at)wi3ck(dot)info>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Limiting memory allocation
Date: 2022-05-17 22:11:51
Message-ID: 1629012.1652825511@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck <jan(at)wi3ck(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2022-05-17 22:30:42 Re: Limiting memory allocation
Previous Message Stephen Frost 2022-05-17 20:12:14 Re: Zstandard support for toast compression