1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Use type "int64" for memory accounting in tuplesort.c/tuplestore.c.

Commit 263865a489 switched tuplesort.c and
tuplestore.c variables representing memory usage from type "long" to
type "Size".  This was unnecessary; I thought doing so avoided overflow
scenarios on 64-bit Windows, but guc.c already limited work_mem so as to
prevent the overflow.  It was also incomplete, not touching the logic
that assumed a signed data type.  Change the affected variables to
"int64".  This is perfect for 64-bit platforms, and it reduces the need
to contemplate platform-specific overflow scenarios.  It also puts us
close to being able to support work_mem over 2 GiB on 64-bit Windows.

Per report from Andres Freund.
This commit is contained in:
Noah Misch
2013-07-04 23:09:54 -04:00
parent 7842d41df5
commit 79e0f87a15
3 changed files with 25 additions and 21 deletions

View File

@@ -106,7 +106,7 @@ extern void tuplesort_get_stats(Tuplesortstate *state,
const char **spaceType,
long *spaceUsed);
extern int tuplesort_merge_order(Size allowedMem);
extern int tuplesort_merge_order(int64 allowedMem);
/*
* These routines may only be called if randomAccess was specified 'true'.