Skip site navigation (1) Skip section navigation (2)

pgsql/src/include/nodes (memnodes.h)

From: Bruce Momjian - CVS <momjian>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql/src/include/nodes (memnodes.h)
Date: 2000-07-11 14:30:36
Message-ID: 200007111430.e6BEUai88208@hub.org (view raw or flat)
Thread:
Lists: pgsql-committers
  Date: Tuesday, July 11, 2000 @ 10:30:36
Author: momjian

Update of /home/projects/pgsql/cvsroot/pgsql/src/include/nodes
     from hub.org:/home/projects/pgsql/tmp/cvs-serv87769/pgsql/src/include/nodes

Modified Files:
	memnodes.h 

-----------------------------  Log Message  -----------------------------

 Here is the patch with memory leak checker. This checker allow detect
in-chunk leaks, overwrite-next-chunk leaks and overwrite block-freeptr leaks.

A in-chunk leak --- if something overwrite space after wanted (via palloc()
size, but it is still inside chunk. For example 

        x = palloc(12);         /* create 16b chunk */
        memset(x, '#', 13);

this leak is in the current source total invisible, because chunk is 16b and
leak is in the "align space".

 For this feature I add data_size to StandardChunk, and all memory which go
from AllocSetAlloc() is marked as 0x7F.

 The MemoryContextCheck() is compiled '#ifdef USE_ASSERT_CHECKING'. 

I add this checking to 'tcop/postgres.c' and is active after each backend
query, but it is probably not sufficient, because some MemoryContext exist
only during memory processing --- will good if someone who known where
it is needful (Tom:-) add it for others contexts;
 A problem in the current source is that we have still some malloc()
allocation that is not needful and this allocation is total invisible for
all context routines. For example Dllist in backend (pretty dirty it is in
catcache where values in Dllist are palloc-ed, but list is malloc-ed).
--- and BTW. this Dllist design stand in the way for query cache :-)

 Tom, if you agree I start replace some mallocs.

 BTW. --- Tom, have you idea for across transaction presistent allocation for
          SQL functions? (like regex - now it is via malloc) 


 I almost forget. I add one if() to AllocSetAlloc(), for 'size' that are 
greater than ALLOC_BIGCHUNK_LIMIT is not needful check AllocSetFreeIndex(), 
because 'fidx' is always 'ALLOCSET_NUM_FREELISTS - 1'. It a little brisk up 
allocation for very large chunks. Right?
 
                                                Karel



pgsql-committers by date

Next:From: Bruce Momjian - CVSDate: 2000-07-11 14:30:37
Subject: pgsql/src/include/utils (memutils.h)
Previous:From: Bruce Momjian - CVSDate: 2000-07-11 14:30:31
Subject: pgsql/src/include (config.h.in)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group