*** ./src/backend/utils/mmgr/aset.c.orig Mon May 16 15:26:32 2005 --- ./src/backend/utils/mmgr/aset.c Mon May 16 18:32:22 2005 *************** *** 395,400 **** --- 395,416 ---- AllocSetCheck(context); #endif + /* + * When blocks list is empty, the context was not used at all. + */ + if(block == NULL) + return; + + /* + * When blocks list has only "keeper" block and freeptr of the block + * is initial value, the context is not used from last reset. + */ + if(block == set->keeper && block->next == NULL) { + char *datastart = ((char *) block) + ALLOC_BLOCKHDRSZ; + if(block->freeptr == datastart) + return; + } + /* Clear chunk freelists */ MemSet(set->freelist, 0, sizeof(set->freelist)); /* New blocks list is either empty or just the keeper block */