Re: Limiting memory allocation
От | Jan Wieck |
---|---|
Тема | Re: Limiting memory allocation |
Дата | |
Msg-id | c4279b7e-a785-1503-7489-a35e72fc4f45@wi3ck.info обсуждение исходный текст |
Ответ на | Re: Limiting memory allocation (Tomas Vondra <tomas.vondra@enterprisedb.com>) |
Список | pgsql-hackers |
On 5/20/22 19:08, Tomas Vondra wrote: > Well, we already have the memory-accounting built into the memory > context infrastructure. It kinda does the same thing as the malloc() > wrapper, except that it does not publish the information anywhere and > it's per-context (so we have to walk the context recursively). > > So maybe we could make this on-request somehow? Say, we'd a signal to > the process, and it'd run MemoryContextMemAllocated() on the top memory > context and store the result somewhere. One remaining problem with all this is that we don't get any feedback from calling free() telling if any memory has been returned to the OS or not. How portable would using sbrk() with a zero size be? If that is an option then I could envision counting actual calls to malloc() and whenever a GUC configurable amount is reached, use sbrk() to find out, do the accounting in shared memory and react accordingly. This way we are not creating another highly contended lock and use authoritative information. Regards, Jan
В списке pgsql-hackers по дате отправления: