xref: /illumos-gate/usr/src/man/man3c/malloc.3c (revision bbf215553c7233fbab8a0afdf1fac74c44781867)
14585130bSYuri Pankov.\"
24585130bSYuri Pankov.\" The contents of this file are subject to the terms of the
34585130bSYuri Pankov.\" Common Development and Distribution License (the "License").
44585130bSYuri Pankov.\" You may not use this file except in compliance with the License.
54585130bSYuri Pankov.\"
64585130bSYuri Pankov.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
74585130bSYuri Pankov.\" or http://www.opensolaris.org/os/licensing.
84585130bSYuri Pankov.\" See the License for the specific language governing permissions
94585130bSYuri Pankov.\" and limitations under the License.
104585130bSYuri Pankov.\"
114585130bSYuri Pankov.\" When distributing Covered Code, include this CDDL HEADER in each
124585130bSYuri Pankov.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
134585130bSYuri Pankov.\" If applicable, add the following below this CDDL HEADER, with the
144585130bSYuri Pankov.\" fields enclosed by brackets "[]" replaced with your own identifying
154585130bSYuri Pankov.\" information: Portions Copyright [yyyy] [name of copyright owner]
164585130bSYuri Pankov.\"
174585130bSYuri Pankov.\"
184585130bSYuri Pankov.\" Copyright 1989 AT&T
194585130bSYuri Pankov.\" Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved.
20f1cdbd37SYuri Pankov.\" Copyright 2017 Nexenta Systems, Inc.
21e7b66456SAndy Fiddaman.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
224585130bSYuri Pankov.\"
23e7b66456SAndy Fiddaman.Dd September 12, 2019
244585130bSYuri Pankov.Dt MALLOC 3C
254585130bSYuri Pankov.Os
264585130bSYuri Pankov.Sh NAME
274585130bSYuri Pankov.Nm malloc ,
284585130bSYuri Pankov.Nm calloc ,
294585130bSYuri Pankov.Nm free ,
30f1cdbd37SYuri Pankov.Nm freezero ,
314585130bSYuri Pankov.Nm memalign ,
324585130bSYuri Pankov.Nm realloc ,
33e7b66456SAndy Fiddaman.Nm reallocf ,
344585130bSYuri Pankov.Nm reallocarray ,
35f1cdbd37SYuri Pankov.Nm recallocarray ,
364585130bSYuri Pankov.Nm valloc ,
374585130bSYuri Pankov.Nm alloca
384585130bSYuri Pankov.Nd memory allocator
394585130bSYuri Pankov.Sh SYNOPSIS
404585130bSYuri Pankov.In stdlib.h
414585130bSYuri Pankov.Ft void *
424585130bSYuri Pankov.Fo malloc
434585130bSYuri Pankov.Fa "size_t size"
444585130bSYuri Pankov.Fc
454585130bSYuri Pankov.Ft void *
464585130bSYuri Pankov.Fo calloc
474585130bSYuri Pankov.Fa "size_t nelem"
484585130bSYuri Pankov.Fa "size_t elsize"
494585130bSYuri Pankov.Fc
504585130bSYuri Pankov.Ft void
514585130bSYuri Pankov.Fo free
524585130bSYuri Pankov.Fa "void *ptr"
534585130bSYuri Pankov.Fc
54f1cdbd37SYuri Pankov.Ft void
55f1cdbd37SYuri Pankov.Fo freezero
56f1cdbd37SYuri Pankov.Fa "void *ptr"
57f1cdbd37SYuri Pankov.Fa "size_t size"
58f1cdbd37SYuri Pankov.Fc
594585130bSYuri Pankov.Ft void *
604585130bSYuri Pankov.Fo memalign
614585130bSYuri Pankov.Fa "size_t alignment"
624585130bSYuri Pankov.Fa "size_t size"
634585130bSYuri Pankov.Fc
644585130bSYuri Pankov.Ft void *
654585130bSYuri Pankov.Fo realloc
664585130bSYuri Pankov.Fa "void *ptr"
674585130bSYuri Pankov.Fa "size_t size"
684585130bSYuri Pankov.Fc
694585130bSYuri Pankov.Ft void *
70e7b66456SAndy Fiddaman.Fo reallocf
71e7b66456SAndy Fiddaman.Fa "void *ptr"
72e7b66456SAndy Fiddaman.Fa "size_t size"
73e7b66456SAndy Fiddaman.Fc
74e7b66456SAndy Fiddaman.Ft void *
754585130bSYuri Pankov.Fo reallocarray
764585130bSYuri Pankov.Fa "void *ptr"
774585130bSYuri Pankov.Fa "size_t nelem"
784585130bSYuri Pankov.Fa "size_t elsize"
794585130bSYuri Pankov.Fc
804585130bSYuri Pankov.Ft void *
81f1cdbd37SYuri Pankov.Fo recallocarray
82f1cdbd37SYuri Pankov.Fa "void *ptr"
83f1cdbd37SYuri Pankov.Fa "size_t oldnelem"
84f1cdbd37SYuri Pankov.Fa "size_t newnelem"
85f1cdbd37SYuri Pankov.Fa "size_t elsize"
86f1cdbd37SYuri Pankov.Fc
87f1cdbd37SYuri Pankov.Ft void *
884585130bSYuri Pankov.Fo valloc
894585130bSYuri Pankov.Fa "size_t size"
904585130bSYuri Pankov.Fc
914585130bSYuri Pankov.In alloca.h
924585130bSYuri Pankov.Ft void *
934585130bSYuri Pankov.Fo alloca
944585130bSYuri Pankov.Fa "size_t size"
954585130bSYuri Pankov.Fc
964585130bSYuri Pankov.Sh DESCRIPTION
974585130bSYuri PankovThe
984585130bSYuri Pankov.Fn malloc
994585130bSYuri Pankovand
1004585130bSYuri Pankov.Fn free
1014585130bSYuri Pankovfunctions provide a simple, general-purpose memory allocation package.
1024585130bSYuri PankovThe
1034585130bSYuri Pankov.Fn malloc
1044585130bSYuri Pankovfunction returns a pointer to a block of at least
1054585130bSYuri Pankov.Fa size
1064585130bSYuri Pankovbytes suitably aligned for any use.
1074585130bSYuri PankovIf the space assigned by
1084585130bSYuri Pankov.Fn malloc
1094585130bSYuri Pankovis overrun, the results are undefined.
1104585130bSYuri Pankov.Pp
1114585130bSYuri PankovThe argument to
1124585130bSYuri Pankov.Fn free
1134585130bSYuri Pankovis a pointer to a block previously allocated by
1144585130bSYuri Pankov.Fn malloc ,
1154585130bSYuri Pankov.Fn calloc ,
1164585130bSYuri Pankov.Fn realloc ,
117e7b66456SAndy Fiddaman.Fn reallocf ,
118f1cdbd37SYuri Pankov.Fn reallocarray ,
1194585130bSYuri Pankovor
120f1cdbd37SYuri Pankov.Fn recallocarray .
1214585130bSYuri PankovAfter
1224585130bSYuri Pankov.Fn free
1234585130bSYuri Pankovis executed, this space is made available for further allocation by the
1244585130bSYuri Pankovapplication, though not returned to the system.
1254585130bSYuri PankovMemory is returned to the system only upon termination of the application.
1264585130bSYuri PankovIf
1274585130bSYuri Pankov.Fa ptr
1284585130bSYuri Pankovis a null pointer, no action occurs.
1294585130bSYuri PankovIf a random number is passed to
1304585130bSYuri Pankov.Fn free ,
1314585130bSYuri Pankovthe results are undefined.
1324585130bSYuri Pankov.Pp
1334585130bSYuri PankovThe
134f1cdbd37SYuri Pankov.Fn freezero
135f1cdbd37SYuri Pankovfunction is similar to the
136f1cdbd37SYuri Pankov.Fn free
137f1cdbd37SYuri Pankovfunction except it ensures memory is explicitly discarded.
138f1cdbd37SYuri PankovIf
139f1cdbd37SYuri Pankov.Fa ptr
140f1cdbd37SYuri Pankovis
141f1cdbd37SYuri Pankov.Dv NULL ,
142f1cdbd37SYuri Pankovno action occurs.
143f1cdbd37SYuri PankovIf
144f1cdbd37SYuri Pankov.Fa ptr
145f1cdbd37SYuri Pankovis not
146f1cdbd37SYuri Pankov.Dv NULL ,
147f1cdbd37SYuri Pankovthe
148f1cdbd37SYuri Pankov.Fa size
149f1cdbd37SYuri Pankovargument must be equal or smaller than the size of the earlier allocation that
150f1cdbd37SYuri Pankovreturned
151f1cdbd37SYuri Pankov.Fa ptr .
152f1cdbd37SYuri Pankov.Fn freezero
153f1cdbd37SYuri Pankovguarantees the memory range starting at
154f1cdbd37SYuri Pankov.Fa ptr
155f1cdbd37SYuri Pankovwith length
156f1cdbd37SYuri Pankov.Fa size
157f1cdbd37SYuri Pankovis discarded while deallocating the whole object originally allocated.
158f1cdbd37SYuri Pankov.Pp
159f1cdbd37SYuri PankovThe
1604585130bSYuri Pankov.Fn calloc
1614585130bSYuri Pankovfunction allocates space for an array of
1624585130bSYuri Pankov.Fa nelem
1634585130bSYuri Pankovelements of size
1644585130bSYuri Pankov.Fa elsize .
1654585130bSYuri PankovThe space is initialized to zeros.
1664585130bSYuri Pankov.Pp
1674585130bSYuri PankovThe
1684585130bSYuri Pankov.Fn memalign
1694585130bSYuri Pankovfunction allocates
1704585130bSYuri Pankov.Fa size
1714585130bSYuri Pankovbytes on a specified alignment boundary and returns a pointer to the allocated
1724585130bSYuri Pankovblock.
1734585130bSYuri PankovThe value of the returned address is guaranteed to be an even multiple of
1744585130bSYuri Pankov.Fa alignment .
1754585130bSYuri PankovThe value of
1764585130bSYuri Pankov.Fa alignment
1774585130bSYuri Pankovmust be a power of two and must be greater than or equal to the size of a word.
1784585130bSYuri Pankov.Pp
1794585130bSYuri PankovThe
1804585130bSYuri Pankov.Fn realloc
1814585130bSYuri Pankovfunction changes the size of the block pointed to by
1824585130bSYuri Pankov.Fa ptr
1834585130bSYuri Pankovto
1844585130bSYuri Pankov.Fa size
1854585130bSYuri Pankovbytes and returns a pointer to the
1864585130bSYuri Pankov.Pq possibly moved
1874585130bSYuri Pankovblock.
1884585130bSYuri PankovThe contents will be unchanged up to the lesser of the new and old sizes.
1894585130bSYuri PankovIf the new size of the block requires movement of the block, the space for the
1904585130bSYuri Pankovprevious instantiation of the block is freed.
1914585130bSYuri PankovIf the new size is larger, the contents of the newly allocated portion of the
1924585130bSYuri Pankovblock are unspecified.
1934585130bSYuri PankovIf
1944585130bSYuri Pankov.Fa ptr
1954585130bSYuri Pankovis
1964585130bSYuri Pankov.Dv NULL ,
1974585130bSYuri Pankov.Fn realloc
1984585130bSYuri Pankovbehaves like
1994585130bSYuri Pankov.Fn malloc
2004585130bSYuri Pankovfor the specified size.
2014585130bSYuri PankovIf
2024585130bSYuri Pankov.Fa size
2034585130bSYuri Pankovis 0 and
2044585130bSYuri Pankov.Fa ptr
2054585130bSYuri Pankovis not a null pointer, the space pointed to is freed.
2064585130bSYuri Pankov.Pp
2074585130bSYuri PankovThe
208e7b66456SAndy Fiddaman.Fn reallocf
209e7b66456SAndy Fiddamanfunction behaves in the same way as
210e7b66456SAndy Fiddaman.Fn realloc
211e7b66456SAndy Fiddamanexcept that the passed pointer is freed automatically on failure.
212e7b66456SAndy Fiddaman.Pp
213e7b66456SAndy FiddamanThe
2144585130bSYuri Pankov.Fn reallocarray
2154585130bSYuri Pankovfunction is similar to
2164585130bSYuri Pankov.Fn realloc ,
2174585130bSYuri Pankovbut operates on
2184585130bSYuri Pankov.Fa nelem
2194585130bSYuri Pankovelements of size
2204585130bSYuri Pankov.Fa elsize
2214585130bSYuri Pankovand checks for overflow in
2224585130bSYuri Pankov.Fa nelem Ns * Ns Fa elsize
2234585130bSYuri Pankovcalculation.
2244585130bSYuri Pankov.Pp
2254585130bSYuri PankovThe
226f1cdbd37SYuri Pankov.Fn recallocarray
227f1cdbd37SYuri Pankovfunction is similar to
228f1cdbd37SYuri Pankov.Fn reallocarray
229f1cdbd37SYuri Pankovexcept it ensures newly allocated memory is cleared similar to
230f1cdbd37SYuri Pankov.Fn calloc .
231f1cdbd37SYuri PankovIf
232f1cdbd37SYuri Pankov.Fa ptr
233f1cdbd37SYuri Pankovis
234f1cdbd37SYuri Pankov.Dv NULL ,
235f1cdbd37SYuri Pankov.Fa oldnelem
236f1cdbd37SYuri Pankovis ignored and the call is equivalent to
237f1cdbd37SYuri Pankov.Fn calloc .
238f1cdbd37SYuri PankovIf
239f1cdbd37SYuri Pankov.Fa ptr
240f1cdbd37SYuri Pankovis not
241f1cdbd37SYuri Pankov.Dv NULL ,
242f1cdbd37SYuri Pankov.Fa oldnelem
243f1cdbd37SYuri Pankovmust be a value such that
244f1cdbd37SYuri Pankov.Fa oldnelem Ns * Ns Fa elsize
245f1cdbd37SYuri Pankovis the size of the earlier allocation that returned
246f1cdbd37SYuri Pankov.Fa ptr ,
247f1cdbd37SYuri Pankovotherwise the behaviour is undefined.
248f1cdbd37SYuri Pankov.Pp
249f1cdbd37SYuri PankovThe
2504585130bSYuri Pankov.Fn valloc
2514585130bSYuri Pankovfunction has the same effect as
2524585130bSYuri Pankov.Fn malloc ,
2534585130bSYuri Pankovexcept that the allocated memory will be aligned to a multiple of the value
2544585130bSYuri Pankovreturned by
2554585130bSYuri Pankov.Nm sysconf Ns Pq Dv _SC_PAGESIZE .
2564585130bSYuri Pankov.Pp
2574585130bSYuri PankovThe
2584585130bSYuri Pankov.Fn alloca
2594585130bSYuri Pankovfunction allocates
2604585130bSYuri Pankov.Fa size
2614585130bSYuri Pankovbytes of space in the stack frame of the caller, and returns a pointer to the
2624585130bSYuri Pankovallocated block.
2634585130bSYuri PankovThis temporary space is automatically freed when the caller returns.
2644585130bSYuri PankovIf the allocated block is beyond the current stack limit, the resulting behavior
2654585130bSYuri Pankovis undefined.
2664585130bSYuri Pankov.Sh RETURN VALUES
267c10c16deSRichard LoweUpon successful completion, each of the allocation functions returns a pointer
2684585130bSYuri Pankovto space suitably aligned
2694585130bSYuri Pankov.Pq after possible pointer coercion
2704585130bSYuri Pankovfor storage of any type of object.
2714585130bSYuri Pankov.Pp
2724585130bSYuri PankovIf there is no available memory,
2734585130bSYuri Pankov.Fn malloc ,
274f1cdbd37SYuri Pankov.Fn calloc ,
2754585130bSYuri Pankov.Fn realloc ,
276e7b66456SAndy Fiddaman.Fn reallocf ,
2774585130bSYuri Pankov.Fn reallocarray ,
278f1cdbd37SYuri Pankov.Fn recallocarray ,
2794585130bSYuri Pankov.Fn memalign ,
2804585130bSYuri Pankovand
281f1cdbd37SYuri Pankov.Fn valloc
2824585130bSYuri Pankovreturn a null pointer.
2834585130bSYuri Pankov.Pp
2844585130bSYuri PankovWhen
2854585130bSYuri Pankov.Fn realloc
2864585130bSYuri Pankovis called with
2874585130bSYuri Pankov.Fa size
2884585130bSYuri Pankov> 0 and returns
2894585130bSYuri Pankov.Dv NULL ,
2904585130bSYuri Pankovthe block pointed to by
2914585130bSYuri Pankov.Fa ptr
2924585130bSYuri Pankovis left intact.
293e7b66456SAndy FiddamanBy contrast, when
294e7b66456SAndy Fiddaman.Fn reallocf
295e7b66456SAndy Fiddamanis called with
296e7b66456SAndy Fiddaman.Fa size
297e7b66456SAndy Fiddaman> 0 and returns
298e7b66456SAndy Fiddaman.Dv NULL ,
299e7b66456SAndy Fiddamanthe block pointed to by
300e7b66456SAndy Fiddaman.Fa ptr
301e7b66456SAndy Fiddamanwill have been freed.
302e7b66456SAndy Fiddaman.Pp
3034585130bSYuri PankovIf
3044585130bSYuri Pankov.Fa size ,
3054585130bSYuri Pankov.Fa nelem ,
3064585130bSYuri Pankovor
3074585130bSYuri Pankov.Fa elsize
3084585130bSYuri Pankovis 0, either a null pointer or a unique pointer that can be passed to
3094585130bSYuri Pankov.Fn free
3104585130bSYuri Pankovis returned.
3114585130bSYuri Pankov.Pp
3124585130bSYuri PankovIf
3134585130bSYuri Pankov.Fn malloc ,
3144585130bSYuri Pankov.Fn calloc ,
3154585130bSYuri Pankov.Fn realloc ,
316e7b66456SAndy Fiddaman.Fn reallocf ,
317f1cdbd37SYuri Pankov.Fn reallocarray ,
3184585130bSYuri Pankovor
319f1cdbd37SYuri Pankov.Fn recallocarray
3204585130bSYuri Pankovreturns unsuccessfully,
3214585130bSYuri Pankov.Va errno
3224585130bSYuri Pankovwill be set to indicate the error.
3234585130bSYuri PankovThe
3244585130bSYuri Pankov.Fn free
325f1cdbd37SYuri Pankovand
326f1cdbd37SYuri Pankov.Fn freezero
327f1cdbd37SYuri Pankovfunctions do not set
3284585130bSYuri Pankov.Va errno .
3294585130bSYuri Pankov.Sh ERRORS
3304585130bSYuri PankovThe
3314585130bSYuri Pankov.Fn malloc ,
3324585130bSYuri Pankov.Fn calloc ,
3334585130bSYuri Pankov.Fn realloc ,
334e7b66456SAndy Fiddaman.Fn reallocf ,
3354585130bSYuri Pankovand
3364585130bSYuri Pankov.Fn reallocarray
3374585130bSYuri Pankovfunctions will fail if:
338f1cdbd37SYuri Pankov.Bl -tag -width Er
3394585130bSYuri Pankov.It Er ENOMEM
3404585130bSYuri PankovThe physical limits of the system are exceeded by
3414585130bSYuri Pankov.Fa size
3424585130bSYuri Pankovbytes of memory which cannot be allocated, or there's integer overflow in
3434585130bSYuri Pankov.Fn reallocarray .
3444585130bSYuri Pankov.It Er EAGAIN
3454585130bSYuri PankovThere is not enough memory available to allocate
3464585130bSYuri Pankov.Fa size
3474585130bSYuri Pankovbytes of memory; but the application could try again later.
3484585130bSYuri Pankov.El
349f1cdbd37SYuri Pankov.Pp
350f1cdbd37SYuri PankovThe
351f1cdbd37SYuri Pankov.Fn recallocarray
352f1cdbd37SYuri Pankovfunction will fail if:
353f1cdbd37SYuri Pankov.Bl -tag -width Er
354f1cdbd37SYuri Pankov.It Er EINVAL
355f1cdbd37SYuri Pankov.Fa ptr
356f1cdbd37SYuri Pankovis not
357f1cdbd37SYuri Pankov.Dv NULL
358f1cdbd37SYuri Pankovand multiplying
359f1cdbd37SYuri Pankov.Fa oldnelem
360f1cdbd37SYuri Pankovand
361f1cdbd37SYuri Pankov.Fa elsize
362f1cdbd37SYuri Pankovresults in integer overflow.
363f1cdbd37SYuri Pankov.El
3644585130bSYuri Pankov.Sh USAGE
3654585130bSYuri PankovPortable applications should avoid using
3664585130bSYuri Pankov.Fn valloc
3674585130bSYuri Pankovbut should instead use
3684585130bSYuri Pankov.Fn malloc
3694585130bSYuri Pankovor
3704585130bSYuri Pankov.Xr mmap 2 .
3714585130bSYuri PankovOn systems with a large page size, the number of successful
3724585130bSYuri Pankov.Fn valloc
3734585130bSYuri Pankovoperations might be 0.
3744585130bSYuri Pankov.Pp
375c10c16deSRichard LoweThese default memory allocation routines are safe for use in multithreaded
3764585130bSYuri Pankovapplications but are not scalable.
3774585130bSYuri PankovConcurrent accesses by multiple threads are single-threaded through the use of a
3784585130bSYuri Pankovsingle lock.
3794585130bSYuri PankovMultithreaded applications that make heavy use of dynamic memory allocation
3804585130bSYuri Pankovshould be linked with allocation libraries designed for concurrent access, such
3814585130bSYuri Pankovas
3824585130bSYuri Pankov.Xr libumem 3LIB
3834585130bSYuri Pankovor
3844585130bSYuri Pankov.Xr libmtmalloc 3LIB .
3854585130bSYuri PankovApplications that want to avoid using heap allocations
3864585130bSYuri Pankov.Pq with Xr brk 2
3874585130bSYuri Pankovcan do so by using either
3884585130bSYuri Pankov.Xr libumem 3LIB
3894585130bSYuri Pankovor
3904585130bSYuri Pankov.Xr libmapmalloc 3LIB .
3914585130bSYuri PankovThe allocation libraries
3924585130bSYuri Pankov.Xr libmalloc 3LIB
3934585130bSYuri Pankovand
3944585130bSYuri Pankov.Xr libbsdmalloc 3LIB
3954585130bSYuri Pankovare available for special needs.
3964585130bSYuri Pankov.Pp
397c10c16deSRichard LoweComparative features of the various allocation libraries can be found in the
3984585130bSYuri Pankov.Xr umem_alloc 3MALLOC
3994585130bSYuri Pankovmanual page.
4004585130bSYuri Pankov.Sh INTERFACE STABILITY
4014585130bSYuri PankovThe
4024585130bSYuri Pankov.Fn malloc ,
4034585130bSYuri Pankov.Fn calloc ,
4044585130bSYuri Pankov.Fn free ,
4054585130bSYuri Pankov.Fn realloc ,
4064585130bSYuri Pankov.Fn valloc
4074585130bSYuri Pankovfunctions are
4084585130bSYuri Pankov.Sy Standard.
4094585130bSYuri Pankov.Pp
4104585130bSYuri PankovThe
411f1cdbd37SYuri Pankov.Fn freezero ,
412e7b66456SAndy Fiddaman.Fn reallocf ,
413f1cdbd37SYuri Pankov.Fn reallocarray ,
414f1cdbd37SYuri Pankovand
415f1cdbd37SYuri Pankov.Fn recallocarray
416f1cdbd37SYuri Pankovfunctions are
4174585130bSYuri Pankov.Sy Committed .
4184585130bSYuri Pankov.Pp
4194585130bSYuri PankovThe
4204585130bSYuri Pankov.Fn memalign
4214585130bSYuri Pankovand
4224585130bSYuri Pankov.Fn alloca
4234585130bSYuri Pankovfunctions are
4244585130bSYuri Pankov.Sy Stable .
4254585130bSYuri Pankov.Sh MT-LEVEL
4264585130bSYuri Pankov.Sy Safe.
4274585130bSYuri Pankov.Sh SEE ALSO
4284585130bSYuri Pankov.Xr brk 2 ,
4294585130bSYuri Pankov.Xr getrlimit 2 ,
4304585130bSYuri Pankov.Xr libbsdmalloc 3LIB ,
4314585130bSYuri Pankov.Xr libmalloc 3LIB ,
4324585130bSYuri Pankov.Xr libmapmalloc 3LIB ,
4334585130bSYuri Pankov.Xr libmtmalloc 3LIB ,
4344585130bSYuri Pankov.Xr libumem 3LIB ,
4354585130bSYuri Pankov.Xr umem_alloc 3MALLOC ,
4364585130bSYuri Pankov.Xr watchmalloc 3MALLOC ,
437*bbf21555SRichard Lowe.Xr attributes 7
4384585130bSYuri Pankov.Sh WARNINGS
439c10c16deSRichard LoweUndefined results will occur if the size requested for a block of memory
440c10c16deSRichard Loweexceeds the maximum size of a process's heap, which can be obtained with
4414585130bSYuri Pankov.Xr getrlimit 2 .
4424585130bSYuri Pankov.Pp
4434585130bSYuri PankovThe
4444585130bSYuri Pankov.Fn alloca
4454585130bSYuri Pankovfunction is machine-, compiler-, and most of all, system-dependent.
4464585130bSYuri PankovIts use is strongly discouraged.
447