Re: BUG #13633: ERROR: invalid memory alloc request size - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #13633: ERROR: invalid memory alloc request size
Date
Msg-id CAKJS1f_sxPyBHF6=nEYwPJdKKDNjVDP91b_EJApfyGTei=ViDw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13633: ERROR: invalid memory alloc request size  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #13633: ERROR: invalid memory alloc request size  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #13633: ERROR: invalid memory alloc request size  (Andreas Hauser <andreas-postgresql@creative-memory.de>)
List pgsql-bugs
On 23 September 2015 at 04:48, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> andreas-postgresql@creative-memory.de writes:
> > SELECT G.MarkerID,G.Allel1,G.Allel2, count (G.TierLIDint) as nH
> >   FROM GenotypHD as G, TiereInSets as TS, Marker as M
> >     WHERE TS.TierSetID='HD.09.15' and TS.TierLIDint=G.TierLIDint and
> > M.Version='3' and M.MarkerID=G.MarkerID and G.Allel1<>G.Allel2
> >     GROUP BY G.MarkerID,G.Allel1,G.Allel2;
>
> > ERROR:  invalid memory alloc request size 1073741824
>
> FWIW, I could not reproduce this on the basis of the supplied information,
> ie just creating the tables and running this query does not do anything
> surprising.  It looks like possibly a corrupt-data issue --- can you do
> "select * from" each table without problems?
>
>
This seems related to this
http://www.postgresql.org/message-id/9A28C8860F777E439AA12E8AEA7694F8010F6F3F@BPXM15GP.gisp.nec.co.jp

work_mem, I believe, must be higher than 1GB to trigger this.

The patch attached to that thread has a bug in the following line

+ memset(hashtable->buckets, 0, sizeof(nbuckets * sizeof(HashJoinTuple)));

It should be:

+ memset(hashtable->buckets, 0, nbuckets * sizeof(HashJoinTuple));

Regards

David Rowley

--
 David Rowley                   http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-bugs by date:

Previous
From: Andreas Hauser
Date:
Subject: Re: BUG #13633: ERROR: invalid memory alloc request size
Next
From: Tom Lane
Date:
Subject: Re: BUG #13633: ERROR: invalid memory alloc request size