On Mon, Jan 22, 2024 at 1:30 AM Kirk Wolak <wol...@gmail.com> wrote:

> On Fri, Jan 19, 2024 at 7:03 PM Daniel Gustafsson <dan...@yesql.se> wrote:
>
>> > On 19 Jan 2024, at 23:09, Kirk Wolak <wol...@gmail.com> wrote:
>>
>> ...
>>     ./configure <other params> --with-llvm
>> LLVM_CONFIG=/path/to/llvm-config
>>
>> --
>> Daniel Gustafsson
>>
>
> Thank you, that made it possible to build and run...
> UNFORTUNATELY this has a CLEAR memory leak (visible in htop)
> I am watching it already consuming 6% of my system memory.
>
>
Daniel,
  In the previous email, I made note that once the JIT was enabled, the
problem exists in 17Devel.
I re-included my script, which forced the JIT to be used...

  I attached an updated script that forced the settings.
But this is still leaking memory (outside of the
pg_backend_memory_context() calls).
Probably because it's at the LLVM level?  And it does NOT happen from
planning/opening the query.  It appears I have to fetch the rows to see the
problem.

Thanks in advance.  Let me know if I should be doing something different?

Kirk Out!
PS: I was wondering if we had a function that showed total memory of the
backend.  For helping to determine if we might have a 3rd party leak?
[increase in total memory consumed not noticed by
pg_backend_memory_contexts)

#include "postgres.h"
#include <sys/resource.h>

PG_MODULE_MAGIC;

PG_FUNCTION_INFO_V1(pg_backend_memory_footprint);

Datum pg_backend_memory_footprint(PG_FUNCTION_ARGS) {
    long memory_usage_bytes = 0;
    struct rusage usage;

    getrusage(RUSAGE_SELF, &usage);
    memory_usage_bytes = usage.ru_maxrss * 1024;

    PG_RETURN_INT64(memory_usage_bytes);
}

Reply via email to