Re: Replace references to malloc() in libpq documentation with generic language - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Replace references to malloc() in libpq documentation with generic language
Date
Msg-id 559227.1698160049@sss.pgh.pa.us
Whole thread Raw
In response to Re: Replace references to malloc() in libpq documentation with generic language  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Replace references to malloc() in libpq documentation with generic language
List pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 24 Oct 2023, at 07:13, Gurjeet Singh <gurjeet@singh.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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges