pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6365: Memory leak in insert and update
5+ messages / 4 participants
[nested] [flat]

* BUG #6365: Memory leak in insert and update
@ 2011-12-29 19:52 havasvolgyi.otto@gmail.com
  2011-12-29 20:10 ` Re: BUG #6365: Memory leak in insert and update Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: havasvolgyi.otto@gmail.com @ 2011-12-29 19:52 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6365
Logged by:          Otto Havasvölgyi
Email address:      havasvolgyi.otto@gmail.com
PostgreSQL version: 9.1.2
Operating system:   Win XP SP2 x86; Linux Debian 2.6.32 kernel x64
Description:        

The bug can be reproduced with pgbench:

Insert script:

\set nbranches 1*:scale
\set ntellers 10*:scale
\set naccounts 100000*:scale
\setrandom aid 1 :naccounts
\setrandom bid 1 :nbranches
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
insert into pgbench_history (tid, bid, aid, delta, mtime) values (:tid,
:bid, :aid, :delta, current_timestamp);

Update script:

\set nbranches 1*:scale
\set ntellers 10*:scale
\set naccounts 100000*:scale
\setrandom aid 1 :naccounts
\setrandom bid 1 :nbranches
\setrandom tid 1 :ntellers
\setrandom delta -5000 5000
update pgbench_accounts set abalance = abalance + :delta where aid = :aid;

Steps:

./pgbench -i -Uotto test

./pgbench -c1 -j1 -T200 -Msimple -N -r -v -f insert.sql -Uotto testdb

./pgbench -c1 -j1 -T200 -Msimple -N -r -v -f update.sql -Uotto testdb

During this test a continuous increase of the backend memory comsumption can
be observed. During the insert test the increase is quite bigger  than
during update.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #6365: Memory leak in insert and update
  2011-12-29 19:52 BUG #6365: Memory leak in insert and update havasvolgyi.otto@gmail.com
@ 2011-12-29 20:10 ` Tom Lane <tgl@sss.pgh.pa.us>
  2011-12-29 21:49   ` Re: BUG #6365: Memory leak in insert and update Merlin Moncure <mmoncure@gmail.com>
  2011-12-30 02:43   ` Re: BUG #6365: Memory leak in insert and update Havasvölgyi Ottó <havasvolgyi.otto@gmail.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Tom Lane @ 2011-12-29 20:10 UTC (permalink / raw)
  To: havasvolgyi.otto@gmail.com; +Cc: pgsql-bugs

havasvolgyi.otto@gmail.com writes:
> The following bug has been logged on the website:
> Bug reference:      6365
> Logged by:          Otto Havasvölgyi
> Email address:      havasvolgyi.otto@gmail.com
> PostgreSQL version: 9.1.2
> Operating system:   Win XP SP2 x86; Linux Debian 2.6.32 kernel x64
> Description:        

> The bug can be reproduced with pgbench:

I see no memory leak with this example.

I suspect you are being fooled by tools that report shared memory as
being used by a process only after it first touches a given page of
shared memory ("top" on Linux does that, for example).  This will cause
the apparent memory consumption of any long-lived backend to increase
until it has touched every available shared buffer.  But that's not a
leak, just an artifact of the reporting tool.  You can confirm for
yourself that that's what's happening by reducing shared_buffers to
a few megabytes and observing that reported memory usage increases up
to that much and then stops growing.

On Linux, I find that watching the "VIRT" column of top output is a
far more reliable guide to whether a memory leak is actually occuring.
Can't offer any suggestions as to what to use on Windows.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #6365: Memory leak in insert and update
  2011-12-29 19:52 BUG #6365: Memory leak in insert and update havasvolgyi.otto@gmail.com
  2011-12-29 20:10 ` Re: BUG #6365: Memory leak in insert and update Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-12-29 21:49   ` Merlin Moncure <mmoncure@gmail.com>
  2011-12-29 22:42     ` Re: BUG #6365: Memory leak in insert and update Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 5+ messages in thread

From: Merlin Moncure @ 2011-12-29 21:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: havasvolgyi.otto@gmail.com; pgsql-bugs

On Thu, Dec 29, 2011 at 2:10 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> havasvolgyi.otto@gmail.com writes:
>> The following bug has been logged on the website:
>> Bug reference:      6365
>> Logged by:          Otto Havasvölgyi
>> Email address:      havasvolgyi.otto@gmail.com
>> PostgreSQL version: 9.1.2
>> Operating system:   Win XP SP2 x86; Linux Debian 2.6.32 kernel x64
>> Description:
>
>> The bug can be reproduced with pgbench:
>
> I see no memory leak with this example.
>
> I suspect you are being fooled by tools that report shared memory as
> being used by a process only after it first touches a given page of
> shared memory ("top" on Linux does that, for example).  This will cause
> the apparent memory consumption of any long-lived backend to increase
> until it has touched every available shared buffer.  But that's not a
> leak, just an artifact of the reporting tool.  You can confirm for
> yourself that that's what's happening by reducing shared_buffers to
> a few megabytes and observing that reported memory usage increases up
> to that much and then stops growing.
>
> On Linux, I find that watching the "VIRT" column of top output is a
> far more reliable guide to whether a memory leak is actually occuring.
> Can't offer any suggestions as to what to use on Windows.

This is by the way a FAQ:
http://wiki.postgresql.org/wiki/FAQ#Why_does_PostgreSQL_use_so_much_memory.3F

merlin



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #6365: Memory leak in insert and update
  2011-12-29 19:52 BUG #6365: Memory leak in insert and update havasvolgyi.otto@gmail.com
  2011-12-29 20:10 ` Re: BUG #6365: Memory leak in insert and update Tom Lane <tgl@sss.pgh.pa.us>
  2011-12-29 21:49   ` Re: BUG #6365: Memory leak in insert and update Merlin Moncure <mmoncure@gmail.com>
@ 2011-12-29 22:42     ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2011-12-29 22:42 UTC (permalink / raw)
  To: Merlin Moncure <mmoncure@gmail.com>; +Cc: havasvolgyi.otto@gmail.com; pgsql-bugs

Merlin Moncure <mmoncure@gmail.com> writes:
> On Thu, Dec 29, 2011 at 2:10 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I see no memory leak with this example.

> This is by the way a FAQ:
> http://wiki.postgresql.org/wiki/FAQ#Why_does_PostgreSQL_use_so_much_memory.3F

Well, to be fair, the FAQ entry didn't mention this behavior of reported
usage increasing over time.  But it seems like a good place to document
that, so I just added a paragraph about it.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: BUG #6365: Memory leak in insert and update
  2011-12-29 19:52 BUG #6365: Memory leak in insert and update havasvolgyi.otto@gmail.com
  2011-12-29 20:10 ` Re: BUG #6365: Memory leak in insert and update Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-12-30 02:43   ` Havasvölgyi Ottó <havasvolgyi.otto@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Havasvölgyi Ottó @ 2011-12-30 02:43 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs

Thanks for the quick response. Linux's top fooled me quite a bit.
Excuse me for the false report.

Best regards,
Otto


2011/12/29 Tom Lane <tgl@sss.pgh.pa.us>

> havasvolgyi.otto@gmail.com writes:
> > The following bug has been logged on the website:
> > Bug reference:      6365
> > Logged by:          Otto Havasvölgyi
> > Email address:      havasvolgyi.otto@gmail.com
> > PostgreSQL version: 9.1.2
> > Operating system:   Win XP SP2 x86; Linux Debian 2.6.32 kernel x64
> > Description:
>
> > The bug can be reproduced with pgbench:
>
> I see no memory leak with this example.
>
> I suspect you are being fooled by tools that report shared memory as
> being used by a process only after it first touches a given page of
> shared memory ("top" on Linux does that, for example).  This will cause
> the apparent memory consumption of any long-lived backend to increase
> until it has touched every available shared buffer.  But that's not a
> leak, just an artifact of the reporting tool.  You can confirm for
> yourself that that's what's happening by reducing shared_buffers to
> a few megabytes and observing that reported memory usage increases up
> to that much and then stops growing.
>
> On Linux, I find that watching the "VIRT" column of top output is a
> far more reliable guide to whether a memory leak is actually occuring.
> Can't offer any suggestions as to what to use on Windows.
>
>                        regards, tom lane
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2011-12-30 02:43 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-12-29 19:52 BUG #6365: Memory leak in insert and update havasvolgyi.otto@gmail.com
2011-12-29 20:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-12-29 21:49   ` Merlin Moncure <mmoncure@gmail.com>
2011-12-29 22:42     ` Tom Lane <tgl@sss.pgh.pa.us>
2011-12-30 02:43   ` Havasvölgyi Ottó <havasvolgyi.otto@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox