From: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: SlabCheck leaks memory into TopMemoryContext |
Date: | 2020-01-16 16:25:00 |
Message-ID: | 20200116162500.pcgxmykirm677mt6@development |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 16, 2020 at 10:27:01AM -0500, Tom Lane wrote:
>Andres Freund <andres(at)anarazel(dot)de> writes:
>> ... I thought you were asking whether
>> any additional memory could just be avoided...
>
>Well, I was kind of wondering that, but if it's not practical then
>preallocating the space instead will do.
>
I don't think it's practical to rework the checks in a way that would
not require allocations. Maybe it's possible, but I think it's not worth
the extra complexity.
The attached fix should do the trick - it pre-allocates the space when
creating the context. There is a bit of complexity because we want to
allocate the space as part of the context header, but nothin too bad. We
might optimize it a bit by using a regular bitmap (instead of just an
array of bools), but I haven't done that.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
slab-leak-fix.patch | text/plain | 3.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-01-16 16:33:44 | Re: Code cleanup for build_regexp_split_result |
Previous Message | Tom Lane | 2020-01-16 15:27:01 | Re: SlabCheck leaks memory into TopMemoryContext |