Commit e7f7cf4a authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

1. LocalBufferSync(): set nextFreeLocalBuf to 0 - we're freeing

   all local buffers @ xact commit, so accordingly nextFreeLocalBuf
   is first local buffer now.
   It helps to avoid unnecessary local buffer allocations in LocalBufferAlloc()
   latter ("memmory leaks" in 'order by').
2. ResetLocalBufferPool() lost allocated local buffers:

   memset(LocalBufferDescriptors, 0, sizeof(BufferDesc) * NLocBuffer);

   (local buffers leak @ xact aborts).
parent 4a8c3ddd
......@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.6 1997/04/18 02:53:37 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.7 1997/05/20 11:30:32 vadim Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -273,6 +273,7 @@ LocalBufferSync(void)
}
memset(LocalRefCount, 0, sizeof(long) * NLocBuffer);
nextFreeLocalBuf = 0;
}
void
......@@ -280,15 +281,15 @@ ResetLocalBufferPool(void)
{
int i;
memset(LocalBufferDescriptors, 0, sizeof(BufferDesc) * NLocBuffer);
nextFreeLocalBuf = 0;
for (i = 0; i < NLocBuffer; i++) {
for (i = 0; i < NLocBuffer; i++)
{
BufferDesc *buf = &LocalBufferDescriptors[i];
/* just like InitLocalBuffer() */
buf->tag.relId.relId = InvalidOid;
buf->flags &= ~BM_DIRTY;
buf->buf_id = - i - 2;
}
memset(LocalRefCount, 0, sizeof(long) * NLocBuffer);
nextFreeLocalBuf = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment