Skip site navigation (1) Skip section navigation (2)

Re: BUG #6763: Severe memory leak with arrays and hstore

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: luben karavelov <karavelov(at)mail(dot)bg>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6763: Severe memory leak with arrays and hstore
Date: 2012-07-27 05:47:05
Message-ID: 25326.1343368025@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> writes:
> OK, it's certainly leaking, but not in the same drastic way I was able 
> to reproduce manually a couple of times earlier. Self-contained test 
> case attached.

Using HEAD with stock parameters, I don't see any significant change in
allocated address space (VSZ): it sits right around 170MB.  The reported
resident set size (RSS) starts from very little and rises to about
140MB, but I think that's just an artifact of the process touching more
and more of the shared-buffers array as it runs.  The actual backend
memory consumption seems to be just a few meg.

I can get it to blow out memory if I set work_mem large enough to
persuade the planner to use hash aggregation (whereupon it tries to run
all the array_agg aggregates in parallel).  However, that requires
work_mem set to a couple of GB, and I don't think it's really a bug when
the backend goes ahead and uses a couple of GB after I told it it could.

It's possible that the OP's problem boiled down to the planner making
a drastic underestimate of the number of GROUP BY groups, which could
mislead it into applying hash aggregation when there's not room; or
if the space used per aggregate was a lot more than the 8K that the
planner assumes when dealing with array_agg.  But neither of those
errors seems to be happening in this example case.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Craig RingerDate: 2012-07-27 05:52:29
Subject: Re: BUG #6763: Severe memory leak with arrays and hstore
Previous:From: Craig RingerDate: 2012-07-27 03:22:14
Subject: Re: BUG #6763: Severe memory leak with arrays and hstore

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group