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

Tweak dynahash.c to avoid wasting memory space in non-shared hash tables.

palloc() will normally round allocation requests up to the next power of 2,
so make dynahash choose allocation sizes that are as close to a power of 2
as possible.
Back-patch to 8.1 --- the problem exists further back, but a much larger
patch would be needed and it doesn't seem worth taking any risks.
This commit is contained in:
Tom Lane
2006-06-25 18:29:49 +00:00
parent f5940e7b34
commit 2924ca6747
2 changed files with 44 additions and 11 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/hsearch.h,v 1.42 2006/03/05 15:59:07 momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/hsearch.h,v 1.43 2006/06/25 18:29:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -156,8 +156,6 @@ typedef struct HASHCTL
/* max_dsize value to indicate expansible directory */
#define NO_MAX_DSIZE (-1)
/* max number of hash elements allocated at once */
#define HASHELEMENT_ALLOC_MAX (32)
/* hash_search operations */
typedef enum