aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/mcxt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/mcxt.h')
-rw-r--r--src/backend/utils/mcxt.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/backend/utils/mcxt.h b/src/backend/utils/mcxt.h
new file mode 100644
index 00000000000..d10019166ef
--- /dev/null
+++ b/src/backend/utils/mcxt.h
@@ -0,0 +1,56 @@
+/*-------------------------------------------------------------------------
+ *
+ * mcxt.h--
+ * POSTGRES memory context definitions.
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: mcxt.h,v 1.1.1.1 1996/07/09 06:22:02 scrappy Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef MCXT_H
+#define MCXT_H
+
+#include "c.h"
+
+#include "nodes/memnodes.h"
+#include "nodes/nodes.h"
+
+extern MemoryContext CurrentMemoryContext;
+extern MemoryContext TopMemoryContext;
+
+
+/*
+ * MaxAllocSize --
+ * Arbitrary limit on size of allocations.
+ *
+ * Note:
+ * There is no guarantee that allocations smaller than MaxAllocSize
+ * will succeed. Allocation requests larger than MaxAllocSize will
+ * be summarily denied.
+ *
+ * This value should not be referenced except in one place in the code.
+ *
+ * XXX This should be defined in a file of tunable constants.
+ */
+#define MaxAllocSize (0xfffffff) /* 16G - 1 */
+
+/*
+ * prototypes for functions in mcxt.c
+ */
+extern void EnableMemoryContext(bool on);
+extern Pointer MemoryContextAlloc(MemoryContext context, Size size);
+extern Pointer MemoryContextRealloc(MemoryContext context,
+ Pointer pointer,
+ Size size);
+extern void MemoryContextFree(MemoryContext context, Pointer pointer);
+extern char *MemoryContextGetName(MemoryContext context);
+extern Size PointerGetAllocSize(Pointer pointer);
+extern MemoryContext MemoryContextSwitchTo(MemoryContext context);
+extern GlobalMemory CreateGlobalMemory(char *name);
+extern void GlobalMemoryDestroy(GlobalMemory context);
+
+
+#endif /* MCXT_H */