diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 28 |
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 |
74 | The standard functions | 75 | The standard functions |
75 | .Fn malloc , | 76 | .Fn malloc , |
@@ -268,7 +269,15 @@ next checks the environment for a variable called | |||
268 | and finally looks at the global variable | 269 | and finally looks at the global variable |
269 | .Va malloc_options | 270 | .Va malloc_options |
270 | in the program. | 271 | in the program. |
271 | Each is scanned for the flags documented below. | 272 | Since |
273 | .Fn malloc | ||
274 | might already get called before the beginning of | ||
275 | .Fn main , | ||
276 | either initialize | ||
277 | .Va malloc_options | ||
278 | to a string literal at file scope or do not declare it at all. | ||
279 | .Pp | ||
280 | Each of the three strings is scanned for the flags documented below. | ||
272 | Unless otherwise noted uppercase means on, lowercase means off. | 281 | Unless otherwise noted uppercase means on, lowercase means off. |
273 | During initialization, flags occurring later modify the behaviour | 282 | During initialization, flags occurring later modify the behaviour |
274 | that was requested by flags processed earlier. | 283 | that was requested by flags processed earlier. |
@@ -363,18 +372,9 @@ Use with | |||
363 | to get a verbose dump of malloc's internal state. | 372 | to get a verbose dump of malloc's internal state. |
364 | .It Cm X | 373 | .It Cm X |
365 | .Dq xmalloc . | 374 | .Dq xmalloc . |
366 | Rather than return failure, | 375 | Rather than return failure to handle out-of-memory conditions gracefully, |
367 | .Xr abort 3 | 376 | .Xr abort 3 |
368 | the program with a diagnostic message on stderr. | 377 | the program with a diagnostic message on stderr. |
369 | It is the intention that this option be set at compile time by | ||
370 | including in the source: | ||
371 | .Bd -literal -offset indent | ||
372 | extern char *malloc_options; | ||
373 | malloc_options = "X"; | ||
374 | .Ed | ||
375 | .Pp | ||
376 | Note that this will cause code that is supposed to handle | ||
377 | out-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 . |
380 | Decrease the size of the free page cache by a factor of two. | 380 | Decrease the size of the free page cache by a factor of two. |