Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man9/malloc.9
Show All 23 Lines | |||||
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||||
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||||
.\" POSSIBILITY OF SUCH DAMAGE. | .\" POSSIBILITY OF SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ | .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd August 3, 2020 | .Dd August 28, 2020 | ||||
.Dt MALLOC 9 | .Dt MALLOC 9 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm malloc , | .Nm malloc , | ||||
.Nm free , | .Nm free , | ||||
.Nm realloc , | .Nm realloc , | ||||
.Nm reallocf , | .Nm reallocf , | ||||
.Nm MALLOC_DEFINE , | .Nm MALLOC_DEFINE , | ||||
Show All 9 Lines | |||||
.Ft void | .Ft void | ||||
.Fn free "void *addr" "struct malloc_type *type" | .Fn free "void *addr" "struct malloc_type *type" | ||||
.Ft void | .Ft void | ||||
.Fn zfree "void *addr" "struct malloc_type *type" | .Fn zfree "void *addr" "struct malloc_type *type" | ||||
.Ft void * | .Ft void * | ||||
.Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" | .Fn realloc "void *addr" "size_t size" "struct malloc_type *type" "int flags" | ||||
.Ft void * | .Ft void * | ||||
.Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" | .Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" | ||||
.Ft size_t | |||||
.Fn malloc_usable_size "const void *addr" | |||||
.Fn MALLOC_DECLARE type | .Fn MALLOC_DECLARE type | ||||
.In sys/param.h | .In sys/param.h | ||||
.In sys/malloc.h | .In sys/malloc.h | ||||
.In sys/kernel.h | .In sys/kernel.h | ||||
.Fn MALLOC_DEFINE type shortdesc longdesc | .Fn MALLOC_DEFINE type shortdesc longdesc | ||||
.In sys/param.h | .In sys/param.h | ||||
.In sys/domainset.h | .In sys/domainset.h | ||||
.Ft void * | .Ft void * | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
for the specified size. | for the specified size. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn reallocf | .Fn reallocf | ||||
function is identical to | function is identical to | ||||
.Fn realloc | .Fn realloc | ||||
except that it | except that it | ||||
will free the passed pointer when the requested memory cannot be allocated. | will free the passed pointer when the requested memory cannot be allocated. | ||||
.Pp | |||||
The | |||||
.Fn malloc_usable_size | |||||
function returns the usable size of the allocation pointed to by | |||||
.Fa addr . | |||||
The return value may be larger than the size that was requested during | |||||
allocation. | |||||
.Pp | .Pp | ||||
Unlike its standard C library counterpart | Unlike its standard C library counterpart | ||||
.Pq Xr malloc 3 , | .Pq Xr malloc 3 , | ||||
the kernel version takes two more arguments. | the kernel version takes two more arguments. | ||||
The | The | ||||
.Fa flags | .Fa flags | ||||
argument further qualifies | argument further qualifies | ||||
.Fn malloc Ns 's | .Fn malloc Ns 's | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |