| From: | "Tristan Partin" <tristan(at)partin(dot)io> |
|---|---|
| To: | "Michael Paquier" <michael(at)paquier(dot)xyz> |
| Cc: | "Sami Imseih" <samimseih(at)gmail(dot)com>, "Daniel Gustafsson" <daniel(at)yesql(dot)se>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Increase repalloc_array() usage in buffile.c |
| Date: | 2026-08-04 18:00:09 |
| Message-ID: | DKGCT2DUBN9C.F872WFDWEY0S@partin.io |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri Jul 31, 2026 at 2:35 AM CDT, Michael Paquier wrote:
> On Fri, Jul 31, 2026 at 03:54:33AM +0000, Tristan Partin wrote:
>> Let me see what I can come up with. As a committer, how would you like
>> the patches? I could do file by file, subsystem by subsystem, or just
>> one large single patch? I don't mind putting in the work to translate
>> all realloc calls where it makes sense, but I would like to make sure
>> I organize it in such a way to minimize work for you.
>
> All of these are mechanical changes, and it is possible to do a set of
> `git add` to split these across sub-directories. So a single huge
> patch does not change much compared to many small ones from my
> perspective. So your call.
I started working on this yesterday. One pattern that became pretty
noticeable was:
buf = MemoryContextAlloc(context, elements * sizeof(*buf));
...
buf = repalloc(buf, new_elements * sizeof(*buf));
I wonder if we should add MemoreContextAllocArray() and friends, similar
to palloc_array().
--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Salma El-Sayed | 2026-08-04 18:01:08 | Re: [GSoC 2026] - B-tree Index Bloat Reduction - Approach & Questions |
| Previous Message | Melanie Plageman | 2026-08-04 17:10:37 | Re: [PATCH] vacuum: stop using stream ring after failsafe |