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

First phase of memory management rewrite (see backend/utils/mmgr/README

for details).  It doesn't really do that much yet, since there are no
short-term memory contexts in the executor, but the infrastructure is
in place and long-term contexts are handled reasonably.  A few long-
standing bugs have been fixed, such as 'VACUUM; anything' in a single
query string crashing.  Also, out-of-memory is now considered a
recoverable ERROR, not FATAL.
Eliminate a large amount of crufty, now-dead code in and around
memory management.
Fix problem with holding off SIGTRAP, SIGSEGV, etc in postmaster and
backend startup.
This commit is contained in:
Tom Lane
2000-06-28 03:33:33 +00:00
parent b601c8d882
commit 1aebc3618a
74 changed files with 2325 additions and 3296 deletions

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: stringinfo.c,v 1.25 2000/04/12 17:15:11 momjian Exp $
* $Id: stringinfo.c,v 1.26 2000/06/28 03:31:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -29,8 +29,6 @@ makeStringInfo(void)
StringInfo res;
res = (StringInfo) palloc(sizeof(StringInfoData));
if (res == NULL)
elog(ERROR, "makeStringInfo: Out of memory");
initStringInfo(res);
@ -49,9 +47,6 @@ initStringInfo(StringInfo str)
int size = 256; /* initial default buffer size */
str->data = (char *) palloc(size);
if (str->data == NULL)
elog(ERROR,
"initStringInfo: Out of memory (%d bytes requested)", size);
str->maxlen = size;
str->len = 0;
str->data[0] = '\0';
@ -62,6 +57,11 @@ initStringInfo(StringInfo str)
*
* Internal routine: make sure there is enough space for 'needed' more bytes
* ('needed' does not include the terminating null).
*
* NB: because we use repalloc() to enlarge the buffer, the string buffer
* will remain allocated in the same memory context that was current when
* initStringInfo was called, even if another context is now current.
* This is the desired and indeed critical behavior!
*/
static void
enlargeStringInfo(StringInfo str, int needed)
@ -83,9 +83,6 @@ enlargeStringInfo(StringInfo str, int needed)
newlen = 2 * newlen;
str->data = (char *) repalloc(str->data, newlen);
if (str->data == NULL)
elog(ERROR,
"enlargeStringInfo: Out of memory (%d bytes requested)", newlen);
str->maxlen = newlen;
}