Everything leaks; How it mm suppose to work?

From: Maurice Gittens <mgittens(at)david(dot)gits(dot)nl>
To: hackers(at)postgresql(dot)org
Subject: Everything leaks; How it mm suppose to work?
Date: 1998-04-02 13:40:57
Message-ID: 199804021340.PAA25443@david.gits.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I added these lines to tcop/postgres.c just before the ReadCommand call
(which is in an infinite loop).

+ printf("Allocount: %ld; FreeCount: %ld; Diff:%ld\n",
+ getPAllocCount(),
+ getPFreeCount(),
+ getPAllocCount() - getPFreeCount());
+

And the following lines to mmgr/palloc.c

+ static long pallocCount = 0;
+ static long pfreeCount = 0;
+
+ long getPAllocCount()
+ {
+ return pallocCount;
+ }
+
+ long getPFreeCount()
+ {
+ return pfreeCount;
+ }

void *
palloc(Size size)
{
+ pallocCount++;
...

void
pfree(void *pointer)
{
+ pfreeCount++;
...

Running postgresql in interactive mode shows that for each query I
type there is memory lost. The exact amount of memory lost depends on
the query I use. The amount of memory not freed is also a function
of the number of tuples returned.

Now I'm hoping there is an easy way to find out about how this is _supposed_
to work. Any one feel like giving a nice little explanation?

Thanks, with regards from Maurice.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-04-02 15:23:05 Re: [HACKERS] Reminder: Indices are not used
Previous Message Thomas G. Lockhart 1998-04-02 13:35:09 Re: [HACKERS] [Q]process for 'contains'.