xref: /netbsd-src/lib/libc/stdlib/memory.3 (revision 06ea77a20cc67471ff182a5f0cd4ad6d51e1fba1)
1*06ea77a2Sabhinav.\"	$NetBSD: memory.3,v 1.12 2017/04/26 07:40:09 abhinav Exp $
26dda330eSthorpej.\"
35f8a6c06Sperry.\" Copyright (c) 1991, 1993
45f8a6c06Sperry.\"	The Regents of the University of California.  All rights reserved.
561f28255Scgd.\"
661f28255Scgd.\" Redistribution and use in source and binary forms, with or without
761f28255Scgd.\" modification, are permitted provided that the following conditions
861f28255Scgd.\" are met:
961f28255Scgd.\" 1. Redistributions of source code must retain the above copyright
1061f28255Scgd.\"    notice, this list of conditions and the following disclaimer.
1161f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright
1261f28255Scgd.\"    notice, this list of conditions and the following disclaimer in the
1361f28255Scgd.\"    documentation and/or other materials provided with the distribution.
14eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors
1561f28255Scgd.\"    may be used to endorse or promote products derived from this software
1661f28255Scgd.\"    without specific prior written permission.
1761f28255Scgd.\"
1861f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1961f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2061f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2161f28255Scgd.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2261f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2361f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2461f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2561f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2661f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2761f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2861f28255Scgd.\" SUCH DAMAGE.
2961f28255Scgd.\"
305f8a6c06Sperry.\"     from: @(#)memory.3	8.1 (Berkeley) 6/4/93
3161f28255Scgd.\"
32*06ea77a2Sabhinav.Dd April 26, 2017
3361f28255Scgd.Dt MEMORY 3
3438c96853Sgarbled.Os
3561f28255Scgd.Sh NAME
36*06ea77a2Sabhinav.Nm memory
3761f28255Scgd.Nd general memory allocation operations
38312aca53Sperry.Sh LIBRARY
39312aca53Sperry.Lb libc
4061f28255Scgd.Sh SYNOPSIS
41472351e1Swiz.In stdlib.h
4261f28255Scgd.Ft void *
4361f28255Scgd.Fn malloc "size_t size"
4461f28255Scgd.Ft void
4561f28255Scgd.Fn free "void *ptr"
4661f28255Scgd.Ft void *
4761f28255Scgd.Fn realloc "void *ptr" "size_t size"
4861f28255Scgd.Ft void *
4961f28255Scgd.Fn calloc "size_t nelem" "size_t elsize"
5061f28255Scgd.Ft void *
5161f28255Scgd.Fn alloca "size_t size"
5261f28255Scgd.Sh DESCRIPTION
5361f28255ScgdThese functions allocate and free memory for the calling process.
5461f28255ScgdThey are described in the
5561f28255Scgdindividual manual pages.
56b43f9512SjruohoThe memory allocators used in the kernel are described in
57b43f9512Sjruoho.Xr memoryallocators 9 .
5861f28255Scgd.Sh SEE ALSO
590af73d03Senami.Xr alloca 3 ,
6061f28255Scgd.Xr calloc 3 ,
6161f28255Scgd.Xr free 3 ,
6261f28255Scgd.Xr malloc 3 ,
630af73d03Senami.Xr realloc 3
6461f28255Scgd.Sh STANDARDS
6561f28255ScgdThese functions, with the exception of
6661f28255Scgd.Fn alloca
6761f28255Scgdconform to
6861f28255Scgd.St -ansiC .
69