| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
| Cc: | Marko Kreen <markokr(at)gmail(dot)com>, Jeff Amiel <becauseimjeff(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Out of Memory - 8.2.4 |
| Date: | 2007-08-30 18:07:57 |
| Message-ID: | 3726.1188497277@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> ! /* no need to allocate more space than we have pages */
> ! maxtuples = LAZY_ALLOC_TUPLES * relblocks;
Uh ... you need to guard against integer overflow in this calculation.
Perhaps leave the current initialization alone, and then after the
Min-reduction steps add
/* curious coding to ensure the multiplication can't overflow */
if ((BlockNumber) (maxtuples / LAZY_ALLOC_TUPLES) > relblocks)
maxtuples = relblocks * LAZY_ALLOC_TUPLES;
which is demonstrably overflow-proof once maxtuples has been clamped to
less than INT_MAX.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gregory Stark | 2007-08-30 18:11:02 | Re: Out of Memory - 8.2.4 |
| Previous Message | Andrew Sullivan | 2007-08-30 17:54:09 | Re: Reliable and fast money transaction design |