Re: shall we have a TRACE_MEMORY mode - Mailing list pgsql-hackers

From Gurjeet Singh
Subject Re: shall we have a TRACE_MEMORY mode
Date
Msg-id 65937bea0606200102k541c5d22vb8ab5d9c443b94d@mail.gmail.com
Whole thread Raw
In response to Re: shall we have a TRACE_MEMORY mode  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 6/20/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> One idea that comes to mind is to have a compile time option to record
> the palloc __FILE__ and _LINE__ in every AllocChunk header.  Then it
> would not be so hard to identify the culprit while trawling through
> memory.  The overhead costs would be so high that you'd never turn it on
> by default though :-(
   Will adding 8 bytes, that too as a compile-time option,  be a big
overhead? 4 for __FILE__'s char* and 4 for __LINE__'s int; this,
assuming 32 bit arch, and that no duplicates of __FILE__ string for
each file are stored in the binary by the compiler, also called
'Enable string Pooling' in VS.Net
(http://msdn2.microsoft.com/en-us/library/s0s0asdt.aspx).

> Another thing to consider is that the proximate location of the palloc
> is frequently *not* very useful.  For instance, if your memory is
> getting eaten by lists, all the palloc traces will point at
> new_tail_cell().  Not much help.  I don't know what to do about that
> ... any ideas?

We can consider such utility functions equivalent to palloc, hence the
caller's __FILE__ and __LINE__ will passed in to these functions, and
these functions will use the same to call the palloc (or the palloc's
#define expanded). So, in effect, in the log files, allocation will
seem to have been done from the location which called the utility
function.

Regards,
Gurjeet.


pgsql-hackers by date:

Previous
From: "Albe Laurenz"
Date:
Subject: Re: PAM auth
Next
From: "Dave Page"
Date:
Subject: Re: CVS HEAD busted on Windows?