summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/malloc.3
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libc/stdlib/malloc.328
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3
index bea5575bf8..ee13b01bd4 100644
--- a/src/lib/libc/stdlib/malloc.3
+++ b/src/lib/libc/stdlib/malloc.3
@@ -30,9 +30,9 @@
30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE. 31.\" SUCH DAMAGE.
32.\" 32.\"
33.\" $OpenBSD: malloc.3,v 1.142 2024/08/03 20:09:24 guenther Exp $ 33.\" $OpenBSD: malloc.3,v 1.147 2025/06/04 00:38:01 yasuoka Exp $
34.\" 34.\"
35.Dd $Mdocdate: August 3 2024 $ 35.Dd $Mdocdate: June 4 2025 $
36.Dt MALLOC 3 36.Dt MALLOC 3
37.Os 37.Os
38.Sh NAME 38.Sh NAME
@@ -69,7 +69,8 @@
69.Fn malloc_conceal "size_t size" 69.Fn malloc_conceal "size_t size"
70.Ft void * 70.Ft void *
71.Fn calloc_conceal "size_t nmemb" "size_t size" 71.Fn calloc_conceal "size_t nmemb" "size_t size"
72.Vt char *malloc_options ; 72.Vt const char * const
73.Va malloc_options ;
73.Sh DESCRIPTION 74.Sh DESCRIPTION
74The standard functions 75The standard functions
75.Fn malloc , 76.Fn malloc ,
@@ -268,7 +269,15 @@ next checks the environment for a variable called
268and finally looks at the global variable 269and finally looks at the global variable
269.Va malloc_options 270.Va malloc_options
270in the program. 271in the program.
271Each is scanned for the flags documented below. 272Since
273.Fn malloc
274might already get called before the beginning of
275.Fn main ,
276either initialize
277.Va malloc_options
278to a string literal at file scope or do not declare it at all.
279.Pp
280Each of the three strings is scanned for the flags documented below.
272Unless otherwise noted uppercase means on, lowercase means off. 281Unless otherwise noted uppercase means on, lowercase means off.
273During initialization, flags occurring later modify the behaviour 282During initialization, flags occurring later modify the behaviour
274that was requested by flags processed earlier. 283that was requested by flags processed earlier.
@@ -363,18 +372,9 @@ Use with
363to get a verbose dump of malloc's internal state. 372to get a verbose dump of malloc's internal state.
364.It Cm X 373.It Cm X
365.Dq xmalloc . 374.Dq xmalloc .
366Rather than return failure, 375Rather than return failure to handle out-of-memory conditions gracefully,
367.Xr abort 3 376.Xr abort 3
368the program with a diagnostic message on stderr. 377the program with a diagnostic message on stderr.
369It is the intention that this option be set at compile time by
370including in the source:
371.Bd -literal -offset indent
372extern char *malloc_options;
373malloc_options = "X";
374.Ed
375.Pp
376Note that this will cause code that is supposed to handle
377out-of-memory conditions gracefully to abort instead.
378.It Cm < 378.It Cm <
379.Dq Halve the cache size . 379.Dq Halve the cache size .
380Decrease the size of the free page cache by a factor of two. 380Decrease the size of the free page cache by a factor of two.