summaryrefslogtreecommitdiff
path: root/src/include/utils/memutils.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-05-22 23:19:37 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-05-22 23:19:37 +0000
commitd52a91a5d8374a438cc0554b4a0d83b9e3616cb2 (patch)
tree18771a00cd8f88ccdc519f91a1d57d7794c27ed4 /src/include/utils/memutils.h
parentf9f90b21b2d6675fe55e97cc85c2e952b475f1f4 (diff)
Modify aset.c logic so that blocks requested from malloc get
bigger the more space is used in an allocset. This reduces the malloc overhead very substantially on queries that need lots of memory.
Diffstat (limited to 'src/include/utils/memutils.h')
-rw-r--r--src/include/utils/memutils.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h
index 009d086311c..e95aec57c90 100644
--- a/src/include/utils/memutils.h
+++ b/src/include/utils/memutils.h
@@ -15,7 +15,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: memutils.h,v 1.23 1999/03/25 19:05:19 tgl Exp $
+ * $Id: memutils.h,v 1.24 1999/05/22 23:19:36 tgl Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -96,7 +96,7 @@ extern void OrderedElemPushInto(OrderedElem elem, OrderedSet Set);
* an allocation is requested for a set, memory is allocated and a
* pointer is returned. Subsequently, this memory may be freed or
* reallocated. In addition, an allocation set may be reset which
- * will cause all allocated memory to be freed.
+ * will cause all memory allocated within it to be freed.
*
* Allocations may occur in four different modes. The mode of
* allocation does not affect the behavior of allocations except in
@@ -109,7 +109,7 @@ extern void OrderedElemPushInto(OrderedElem elem, OrderedSet Set);
* and freed very frequently. This is a good choice when allocation
* characteristics are unknown. This is the default mode.
*
- * "Static" mode attemts to allocate space as efficiently as possible
+ * "Static" mode attempts to allocate space as efficiently as possible
* without regard to freeing memory. This mode should be chosen only
* when it is known that many allocations will occur but that very
* little of the allocated memory will be explicitly freed.
@@ -129,7 +129,7 @@ extern void OrderedElemPushInto(OrderedElem elem, OrderedSet Set);
* Allocation sets are not automatically reset on a system reset.
* Higher level code is responsible for cleaning up.
*
- * There may other modes in the future.
+ * There may be other modes in the future.
*/
/*
@@ -176,7 +176,9 @@ typedef AllocBlockData *AllocBlock;
* The prefix of each piece of memory in an AllocBlock
*/
typedef struct AllocChunkData {
+ /* aset is the owning aset if allocated, or the freelist link if free */
void *aset;
+ /* size is always the chunk size */
Size size;
} AllocChunkData;
@@ -189,7 +191,8 @@ typedef AllocChunkData *AllocChunk;
typedef struct AllocSetData
{
struct AllocBlockData *blocks;
- struct AllocChunkData *freelist[8];
+#define ALLOCSET_NUM_FREELISTS 8
+ struct AllocChunkData *freelist[ALLOCSET_NUM_FREELISTS];
/* Note: this will change in the future to support other modes */
} AllocSetData;