Re: psql leaks memory on query cancellation

From: Darafei "Komяpa" Praliaskouski <me(at)komzpa(dot)net>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql leaks memory on query cancellation
Date: 2018-04-12 12:37:54
Message-ID: CAC8Q8tKw3uRg0GBN7ESpktFGipJSPMaVWcV+WuzwBMHpdkPwFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> > Is it expected behavior (so I can have a look at something server
> returned
> > somehow and it's kept there for me), or a plain leak?
>
> This is totally normal behaviour for any C program.
>

Thanks Konstantin and Craig for the help.

To mitigate the issue I've changed the allocator on my laptop to jemalloc.
For single psql run on my Ubuntu system:

sudo apt install libjemalloc1
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1 psql

A global replacement by putting /usr/lib/x86_64-linux-gnu/libjemalloc.so.1
to /etc/ld.so.preload also had a positive effect fixing this behavior in
all the applications, reducing after-boot memory footprint from 7 GB to 3.

Darafei Praliaskouski,
GIS Engineer / Juno Minsk

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2018-04-12 12:51:24 Re: Boolean partitions syntax
Previous Message Aleksander Alekseev 2018-04-12 12:11:25 Re: Covering GiST indexes