public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: Jonny Grant <jg@jguk.org>
Cc: linux-man <linux-man@vger.kernel.org>
Subject: Re: should free() refer to posix_memalign?
Date: Fri, 8 Oct 2021 14:30:38 +0200	[thread overview]
Message-ID: <3c8ceb24-dc7d-4f57-e532-f2abbb20da2d@gmail.com> (raw)
In-Reply-To: <177c3be6-6bab-7e55-6fa5-fc0fc33ff3b2@jguk.org>

Hi Jonny,

On 10/8/21 1:19 PM, Jonny Grant wrote:
> Hello
> 
> https://man7.org/linux/man-pages/man3/malloc.3.html
> 
> "The free() function frees the memory space pointed to by ptr,
>   which must have been returned by a previous call to malloc(),
>   calloc(), or realloc().  "
> 

Agree that this is somewhat wrong.

> 
> Could this list refer to the other ways memory can be allocated too? free() accepts other memory.
> posix_memalign
> aligned_alloc
> memalign
> valloc
> pvalloc
> reallocarray
> 
> That would be changing it to say :-
> 
> "The free() function frees the memory space pointed to by ptr,
>   which must have been returned by a previous call to malloc(),
>   calloc(), realloc(), posix_memalign(), aligned_alloc(), memalign(), valloc(), reallocarray() or pvalloc()"

I don't like that list.  It is incomplete (the first one that comes to 
my mind is asprintf(3)).  Either we provide a _complete_ list of 
functions that can be free(3)d, which I think will be difficult to keep 
up to date, or we use the same wording as POSIX, and say that it 
deallocates memory allocated as if by malloc(3).


What are your thoughts?

Thanks,

Alex

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

  reply	other threads:[~2021-10-08 12:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 11:19 should free() refer to posix_memalign? Jonny Grant
2021-10-08 12:30 ` Alejandro Colomar (man-pages) [this message]
2021-10-08 13:28   ` Jonny Grant
2021-10-08 14:58     ` Alejandro Colomar (man-pages)
2021-10-08 17:57       ` Jonny Grant
2021-10-09 18:39         ` Alejandro Colomar (man-pages)
2021-10-09 20:15           ` Jonny Grant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c8ceb24-dc7d-4f57-e532-f2abbb20da2d@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=jg@jguk.org \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox