diff mbox series

manual: reallocarray and str*dup interposition is not supported

Message ID 20210720014329.1251125-1-siddhesh@sourceware.org
State New
Headers show
Series manual: reallocarray and str*dup interposition is not supported | expand

Commit Message

Siddhesh Poyarekar July 20, 2021, 1:43 a.m. UTC
These functions call the core allocator functions (realloc and malloc
respectively) and are hence guaranteed to allocate memory using the
correct functions when multiple allocators are interposed.  Having
these functions interposed in one allocator and not another may result
in confusion, hence discourage interposing them altogether.
---
 manual/memory.texi | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Florian Weimer July 20, 2021, 8:05 a.m. UTC | #1
* Siddhesh Poyarekar:

> These functions call the core allocator functions (realloc and malloc
> respectively) and are hence guaranteed to allocate memory using the
> correct functions when multiple allocators are interposed.  Having
> these functions interposed in one allocator and not another may result
> in confusion, hence discourage interposing them altogether.
> ---
>  manual/memory.texi | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/manual/memory.texi b/manual/memory.texi
> index 31ee36be8c..4560781f64 100644
> --- a/manual/memory.texi
> +++ b/manual/memory.texi
> @@ -2033,6 +2033,11 @@ when a replacement @code{malloc} is in use.  However, failure to replace
>  these functions typically does not result in crashes or other incorrect
>  application behavior, but may result in static linking failures.
>  
> +Replacing the @code{reallocarray} function and the @code{strdup} family of
> +functions is not supported and may produce incorrect results. @theglibc{}
> +implementations of these functions call the replacement @code{malloc} and
> +@code{realloc} functions whenever available.

There are other examples: realpath, getcwd, asprintf, and more.  So
please rephrase this in such a way that reallocarray and strdup are just
examples of memory-allocating library functions that call the
replacement malloc implementation.

Thanks,
Florian
diff mbox series

Patch

diff --git a/manual/memory.texi b/manual/memory.texi
index 31ee36be8c..4560781f64 100644
--- a/manual/memory.texi
+++ b/manual/memory.texi
@@ -2033,6 +2033,11 @@  when a replacement @code{malloc} is in use.  However, failure to replace
 these functions typically does not result in crashes or other incorrect
 application behavior, but may result in static linking failures.
 
+Replacing the @code{reallocarray} function and the @code{strdup} family of
+functions is not supported and may produce incorrect results. @theglibc{}
+implementations of these functions call the replacement @code{malloc} and
+@code{realloc} functions whenever available.
+
 @node Obstacks
 @subsection Obstacks
 @cindex obstacks