Thread: What is pg backend using memory for?
Hi, So, I checked a backend on Linux, and found such thing: 2ba63c797000-2ba63fa68000 rw-p 2ba63c797000 00:00 0 Size: 52036 kB Rss: 51336 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 51336 kB Swap: 0 kB Pss: 51336 kB (this is part of /proc/<pid>/smaps). This is not shared memory, so it's local. It's not related to any files (in such case first line would have path to file). What's more - this backend, during getting smaps copy was idle, and it's not stats manager, or anything like this. How can this be diagnosed, to find out why there is so much private memory? In case it matters: it's pg 9.1.6 on linux 2.6.18-164.2.1.el5 Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/
hubert depesz lubaczewski wrote: > So, I checked a backend on Linux, and found such thing: > 2ba63c797000-2ba63fa68000 rw-p 2ba63c797000 00:00 0 > Size: 52036 kB > Rss: 51336 kB > Shared_Clean: 0 kB > Shared_Dirty: 0 kB > Private_Clean: 0 kB > Private_Dirty: 51336 kB > Swap: 0 kB > Pss: 51336 kB > > (this is part of /proc/<pid>/smaps). > > This is not shared memory, so it's local. It's not related to any files (in such case first line would > have path to file). > > What's more - this backend, during getting smaps copy was idle, and it's not stats manager, or > anything like this. > > How can this be diagnosed, to find out why there is so much private > memory? > > In case it matters: it's pg 9.1.6 on linux 2.6.18-164.2.1.el5 What libraries are loaded in this backend (lsof)? Maybe it's something non-PostgreSQL that's hogging the memory. Yours, Laurenz Albe
On Wed, Apr 10, 2013 at 07:36:59AM +0000, Albe Laurenz wrote: > What libraries are loaded in this backend (lsof)? > Maybe it's something non-PostgreSQL that's hogging the memory. I don't have this particular backend anymore, and I don't have lsof. But in smaps there are libraries listed, so: Still there is 51MB non-shared block: 2ba63c797000-2ba63fa68000 rw-p 2ba63c797000 00:00 0 Size: 52036 kB Rss: 51340 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 51340 kB Swap: 0 kB Pss: 51340 kB As for libraries: => grep / smaps | awk '{print $NF}' | sort | uniq (deleted) /lib64/ld-2.5.so /lib64/libc-2.5.so /lib64/libcom_err.so.2.1 /lib64/libcrypt-2.5.so /lib64/libcrypto.so.0.9.8e /lib64/libdl-2.5.so /lib64/libkeyutils-1.2.so /lib64/libm-2.5.so /lib64/libnss_files-2.5.so /lib64/libresolv-2.5.so /lib64/libselinux.so.1 /lib64/libsepol.so.1 /lib64/libssl.so.0.9.8e /opt/pgbrew/9.1.6/bin/postgres /opt/pgbrew/9.1.6/lib/postgresql/auto_explain.so /opt/pgbrew/9.1.6/lib/postgresql/plpgsql.so /usr/lib64/gconv/gconv-modules.cache /usr/lib64/libgssapi_krb5.so.2.2 /usr/lib64/libk5crypto.so.3.1 /usr/lib64/libkrb5.so.3.3 /usr/lib64/libkrb5support.so.0.1 /usr/lib64/libxml2.so.2.6.26 /usr/lib64/libz.so.1.2.3 /usr/lib/locale/locale-archive the "(deleted)" is shared memory file. depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/