83 often the more restrictive constraint on large-memory configurations.
84
85
86 Excessive use of kernel memory is likely to affect overall system
87 performance. Overcommitment of kernel memory will cause the system to
88 hang or panic.
89
90
91 Misuse of the kernel memory allocator, such as writing past the end of
92 a buffer, using a buffer after freeing it, freeing a buffer twice, or
93 freeing a null or invalid pointer, will corrupt the kernel heap and may
94 cause the system to corrupt data or panic.
95
96
97 The initial contents of memory allocated using kmem_alloc() are random
98 garbage. This random garbage may include secure kernel data. Therefore,
99 uninitialized kernel memory should be handled carefully. For example,
100 never copyout(9F) a potentially uninitialized buffer.
101
102 NOTES
103 kmem_alloc(0, flag) always returns NULL. kmem_free(NULL, 0) is legal.
104
105
106
107 October 22, 2014 KMEM_ALLOC(9F)
|
83 often the more restrictive constraint on large-memory configurations.
84
85
86 Excessive use of kernel memory is likely to affect overall system
87 performance. Overcommitment of kernel memory will cause the system to
88 hang or panic.
89
90
91 Misuse of the kernel memory allocator, such as writing past the end of
92 a buffer, using a buffer after freeing it, freeing a buffer twice, or
93 freeing a null or invalid pointer, will corrupt the kernel heap and may
94 cause the system to corrupt data or panic.
95
96
97 The initial contents of memory allocated using kmem_alloc() are random
98 garbage. This random garbage may include secure kernel data. Therefore,
99 uninitialized kernel memory should be handled carefully. For example,
100 never copyout(9F) a potentially uninitialized buffer.
101
102 NOTES
103 kmem_alloc(0, flag) always returns NULL, but if KM_SLEEP is set, this
104 behavior is considered to be deprecated; the system may be configured
105 to explicitly panic in this case in lieu of returning NULL.
106 kmem_free(NULL, 0) is legal, however.
107
108
109
110 November 20, 2019 KMEM_ALLOC(9F)
|