Re: Replace references to malloc() in libpq documentation with generic language

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Gurjeet Singh <gurjeet(at)singh(dot)im>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Replace references to malloc() in libpq documentation with generic language
Date: 2023-10-24 15:07:29
Message-ID: 559227.1698160049@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 24 Oct 2023, at 07:13, Gurjeet Singh <gurjeet(at)singh(dot)im> wrote:
>> The user does not benefit from knowing that libpq allocates some/all memory
>> using malloc(). Mentioning malloc() here has a few downsides, and almost no
>> benefits.

> I'm not entirely convinced that replacing "malloc" with "allocated on the heap"
> improves the documentation.

That was my reaction too. The underlying storage allocator *is* malloc,
and C programmers know what that is, and I don't see how obfuscating
that improves matters. It's true that on the miserable excuse for a
platform that is Windows, you have to use PQfreemem because of
Microsoft's inability to supply a standards-compliant implementation
of malloc. But I'm not inclined to let that tail wag the dog.

> I do agree with this proposed change though:

> - all the space that will be freed by <xref linkend="libpq-PQclear"/>.
> + all the memory that will be freed by <xref linkend="libpq-PQclear"/>.

+1, seems harmless.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-10-24 15:16:54 Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges
Previous Message Peter Eisentraut 2023-10-24 15:03:04 Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements