xref: /freebsd/lib/libuvmem/libuvmem.3 (revision 7295aeaf5f5cbbbb16d4992b13b08bce09f03609)
1.\" SPDX-License-Identifier: BSD-2-Clause
2.\"
3.\" Copyright (c) 2025 The FreeBSD Foundation
4.\"
5.\" This documentation was written by
6.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
7.\" from the FreeBSD Foundation.
8.\"
9.Dd October 16, 2025
10.Dt LIBUVMEM 3
11.Os
12.Sh NAME
13.Nm libuvmem
14.Nd userspace general purpose resource allocator
15.Sh SYNOPSIS
16.Lb libuvmem
17.In sys/vmem.h
18.Sh DESCRIPTION
19The
20.Nm
21is a general purpose resource allocator.
22It is a port of the kernel facility of the similar name
23.Nm vmem .
24.Pp
25Refer to the description of the kernel allocator
26.Xr vmem 9
27to get the documentation for it.
28.Sh NOTES
29The
30.Dq quantum cache
31feature is not implemented for userspace, and the
32.Fa quantum
33and
34.Fa qcache_max
35arguments of the
36.Fn vmem_create
37function are ignored.
38.Pp
39The library internally uses
40.Xr malloc 3
41to allocate structures tracking allocations.
42.Pp
43The allocator is thread-safe.
44Locks for separate
45.Nm vmem's
46are independent between each other.
47.Pp
48The supported
49.Fa flags
50for the
51.Fn vmem_xalloc
52function are
53.Bl -bullet
54.It
55.Dv M_NOWAIT
56.It
57.Dv M_FIRSTFIT
58.It
59.Dv M_BESTFIT
60.It
61.Dv M_NEXTFIT
62.El
63.Sh AUTHORS
64See
65.Xr vmem 9
66for the history of the kernel allocator.
67.Pp
68The userspace port for
69.Fx
70was done by
71.An Konstantin Belousov Aq Mt kib@FreeBSD.org .
72