malloc.9 (74ca6a22f9c1ff9ea407de7053891fca5a680402) malloc.9 (30c6a66864821d3b47e25612c0d2e727ec36154e)
1.\"
2.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to The NetBSD Foundation
6.\" by Paul Kranenburg.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 15 unchanged lines hidden (view full) ---

24.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27.\" POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
30.\" $FreeBSD$
31.\"
1.\"
2.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to The NetBSD Foundation
6.\" by Paul Kranenburg.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 15 unchanged lines hidden (view full) ---

24.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27.\" POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $
30.\" $FreeBSD$
31.\"
32.Dd July 2, 2021
32.Dd October 12, 2022
33.Dt MALLOC 9
34.Os
35.Sh NAME
36.Nm malloc ,
33.Dt MALLOC 9
34.Os
35.Sh NAME
36.Nm malloc ,
37.Nm mallocarray ,
37.Nm free ,
38.Nm free ,
39.Nm zfree ,
38.Nm realloc ,
39.Nm reallocf ,
40.Nm realloc ,
41.Nm reallocf ,
42.Nm malloc_usable_size ,
43.Nm malloc_aligned ,
44.Nm malloc_exec ,
45.Nm MALLOC_DECLARE ,
40.Nm MALLOC_DEFINE ,
46.Nm MALLOC_DEFINE ,
41.Nm MALLOC_DECLARE
47.Nm malloc_domainset ,
48.Nm malloc_domainset_aligned ,
49.Nm malloc_domainset_exec ,
50.Nm mallocarray_domainset
42.Nd kernel memory management routines
43.Sh SYNOPSIS
44.In sys/types.h
45.In sys/malloc.h
46.Ft void *
47.Fn malloc "size_t size" "struct malloc_type *type" "int flags"
48.Ft void *
49.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags"

--- 18 unchanged lines hidden (view full) ---

68.Fn malloc_exec "size_t size" "struct malloc_type *type" "int flags"
69.Fn MALLOC_DECLARE type
70.In sys/param.h
71.In sys/malloc.h
72.In sys/kernel.h
73.Fn MALLOC_DEFINE type shortdesc longdesc
74.In sys/param.h
75.In sys/domainset.h
51.Nd kernel memory management routines
52.Sh SYNOPSIS
53.In sys/types.h
54.In sys/malloc.h
55.Ft void *
56.Fn malloc "size_t size" "struct malloc_type *type" "int flags"
57.Ft void *
58.Fn mallocarray "size_t nmemb" "size_t size" "struct malloc_type *type" "int flags"

--- 18 unchanged lines hidden (view full) ---

77.Fn malloc_exec "size_t size" "struct malloc_type *type" "int flags"
78.Fn MALLOC_DECLARE type
79.In sys/param.h
80.In sys/malloc.h
81.In sys/kernel.h
82.Fn MALLOC_DEFINE type shortdesc longdesc
83.In sys/param.h
84.In sys/domainset.h
85.In sys/malloc.h
76.Ft void *
77.Fn malloc_domainset "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags"
78.Ft void *
79.Fo malloc_domainset_aligned
80.Fa "size_t size"
81.Fa "size_t align"
82.Fa "struct malloc_type *type"
83.Fa "struct domainset *ds"

--- 27 unchanged lines hidden (view full) ---

111.Fa align ,
112which must be non-zero, a power of two, and less than or equal to the page size.
113.Pp
114Both
115.Fn malloc_exec
116and
117.Fn malloc_domainset_exec
118can be used to return executable memory.
86.Ft void *
87.Fn malloc_domainset "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags"
88.Ft void *
89.Fo malloc_domainset_aligned
90.Fa "size_t size"
91.Fa "size_t align"
92.Fa "struct malloc_type *type"
93.Fa "struct domainset *ds"

--- 27 unchanged lines hidden (view full) ---

121.Fa align ,
122which must be non-zero, a power of two, and less than or equal to the page size.
123.Pp
124Both
125.Fn malloc_exec
126and
127.Fn malloc_domainset_exec
128can be used to return executable memory.
119Not all platforms enforce a distinction between executable and non-executable memory.
129Not all platforms enforce a distinction between executable and non-executable
130memory.
120.Pp
121The
122.Fn mallocarray
123function allocates uninitialized memory in kernel address space for an
124array of
125.Fa nmemb
126entries whose size is specified by
127.Fa size .

--- 260 unchanged lines hidden ---
131.Pp
132The
133.Fn mallocarray
134function allocates uninitialized memory in kernel address space for an
135array of
136.Fa nmemb
137entries whose size is specified by
138.Fa size .

--- 260 unchanged lines hidden ---