mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.41 2000/01/26 05:56:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.42 2000/06/28 03:31:56 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -136,7 +136,7 @@ prs2_addToRelation(Oid relid,
|
||||
* create an in memory RewriteRule data structure which is cached by
|
||||
* every Relation descriptor. (see utils/cache/relcache.c)
|
||||
*/
|
||||
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
thisRule = (RewriteRule *) palloc(sizeof(RewriteRule));
|
||||
if (qual != NULL)
|
||||
qual = copyObject(qual);
|
||||
@ -159,7 +159,7 @@ prs2_addToRelation(Oid relid,
|
||||
if (relation->rd_rules == NULL)
|
||||
{
|
||||
|
||||
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
rulelock = (RuleLock *) palloc(sizeof(RuleLock));
|
||||
rulelock->numLocks = 1;
|
||||
rulelock->rules = (RewriteRule **) palloc(sizeof(RewriteRule *));
|
||||
@ -181,7 +181,7 @@ prs2_addToRelation(Oid relid,
|
||||
rulelock = relation->rd_rules;
|
||||
numlock = rulelock->numLocks;
|
||||
/* expand, for safety reasons */
|
||||
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
rulelock->rules = (RewriteRule **) repalloc(rulelock->rules,
|
||||
sizeof(RewriteRule *) * (numlock + 1));
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
@ -212,7 +212,7 @@ prs2_deleteFromRelation(Oid relid, Oid ruleId)
|
||||
break;
|
||||
}
|
||||
Assert(i < numlock);
|
||||
oldcxt = MemoryContextSwitchTo((MemoryContext) CacheCxt);
|
||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
||||
pfree(rulelock->rules[i]);
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
if (numlock == 1)
|
||||
|
Reference in New Issue
Block a user