1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Tweak default memory context allocation policy so that a context is not

given any malloc block until something is first allocated in it; but
thereafter, MemoryContextReset won't release that first malloc block.
This preserves the quick-reset property of the original policy, without
forcing 8K to be allocated to every context whether any of it is ever
used or not.  Also, remove some more no-longer-needed explicit freeing
during ExecEndPlan.
This commit is contained in:
Tom Lane
2002-12-15 21:01:34 +00:00
parent 5bab36e9f6
commit e64c7feb2f
11 changed files with 66 additions and 99 deletions

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: memutils.h,v 1.48 2002/09/04 20:31:45 momjian Exp $
* $Id: memutils.h,v 1.49 2002/12/15 21:01:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -116,8 +116,16 @@ extern MemoryContext AllocSetContextCreate(MemoryContext parent,
* Recommended default alloc parameters, suitable for "ordinary" contexts
* that might hold quite a lot of data.
*/
#define ALLOCSET_DEFAULT_MINSIZE (8 * 1024)
#define ALLOCSET_DEFAULT_MINSIZE 0
#define ALLOCSET_DEFAULT_INITSIZE (8 * 1024)
#define ALLOCSET_DEFAULT_MAXSIZE (8 * 1024 * 1024)
/*
* Recommended alloc parameters for "small" contexts that are not expected
* to contain much data (for example, a context to contain a query plan).
*/
#define ALLOCSET_SMALL_MINSIZE 0
#define ALLOCSET_SMALL_INITSIZE (1 * 1024)
#define ALLOCSET_SMALL_MAXSIZE (8 * 1024)
#endif /* MEMUTILS_H */