Re: SlabCheck leaks memory into TopMemoryContext - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SlabCheck leaks memory into TopMemoryContext
Date
Msg-id 27213.1579155900@sss.pgh.pa.us
Whole thread Raw
In response to Re: SlabCheck leaks memory into TopMemoryContext  (Andres Freund <andres@anarazel.de>)
Responses Re: SlabCheck leaks memory into TopMemoryContext  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2020-01-16 00:09:53 -0500, Tom Lane wrote:
>> It's basically assuming that the memory management mechanism is sane,
>> which makes the whole thing fundamentally circular, even if it's
>> relying on some other context to be sane.  Is there a way to do the
>> checking without extra allocations?

> Probably not easily.

In the AllocSet code, we don't hesitate to expend extra space per-chunk
for debug support:

typedef struct AllocChunkData
{
...
#ifdef MEMORY_CONTEXT_CHECKING
    Size        requested_size;
#endif
...

I don't see a pressing reason why SlabContext couldn't do something
similar, either per-chunk or per-context, whatever makes sense.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: SlabCheck leaks memory into TopMemoryContext
Next
From: Andres Freund
Date:
Subject: Re: SlabCheck leaks memory into TopMemoryContext