| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 3: Basic Library Functions Oracle Solaris 11 Information Library |
enable_extended_FILE_stdio(3C)
posix_spawnattr_getschedparam(3C)
posix_spawnattr_getschedpolicy(3C)
posix_spawnattr_getsigdefault(3C)
posix_spawnattr_getsigignore_np(3C)
posix_spawnattr_getsigmask(3C)
posix_spawnattr_setschedparam(3C)
posix_spawnattr_setschedpolicy(3C)
posix_spawnattr_setsigdefault(3C)
posix_spawnattr_setsigignore_np(3C)
posix_spawnattr_setsigmask(3C)
posix_spawn_file_actions_addclose(3C)
posix_spawn_file_actions_addclosefrom_np(3C)
posix_spawn_file_actions_adddup2(3C)
posix_spawn_file_actions_addopen(3C)
posix_spawn_file_actions_destroy(3C)
posix_spawn_file_actions_init(3C)
pthread_attr_getdetachstate(3C)
pthread_attr_getinheritsched(3C)
pthread_attr_getschedparam(3C)
pthread_attr_getschedpolicy(3C)
pthread_attr_setdetachstate(3C)
pthread_attr_setinheritsched(3C)
pthread_attr_setschedparam(3C)
pthread_attr_setschedpolicy(3C)
pthread_barrierattr_destroy(3C)
pthread_barrierattr_getpshared(3C)
pthread_barrierattr_setpshared(3C)
pthread_condattr_getpshared(3C)
pthread_condattr_setpshared(3C)
pthread_cond_reltimedwait_np(3C)
pthread_key_create_once_np(3C)
pthread_mutexattr_getprioceiling(3C)
pthread_mutexattr_getprotocol(3C)
pthread_mutexattr_getpshared(3C)
pthread_mutexattr_getrobust(3C)
pthread_mutexattr_setprioceiling(3C)
pthread_mutexattr_setprotocol(3C)
pthread_mutexattr_setpshared(3C)
pthread_mutexattr_setrobust(3C)
pthread_mutex_getprioceiling(3C)
pthread_mutex_reltimedlock_np(3C)
pthread_mutex_setprioceiling(3C)
pthread_rwlockattr_destroy(3C)
pthread_rwlockattr_getpshared(3C)
pthread_rwlockattr_setpshared(3C)
pthread_rwlock_reltimedrdlock_np(3C)
pthread_rwlock_reltimedwrlock_np(3C)
pthread_rwlock_timedrdlock(3C)
pthread_rwlock_timedwrlock(3C)
rctlblk_get_enforced_value(3C)
- memory allocator
cc [flag ... ]file ...-lmapmalloc [library ... ]#include <stdlib.h>void *malloc(size_tsize);
void *calloc(size_tnelem,size_telsize);
voidfree(void *ptr);
void *realloc(void *ptr,size_tsize);
The collection ofmalloc functions in this library usemmap(2) insteadofsbrk(2) for acquiring new heap space. The functions in thislibrary are intended to be used only if necessary, when applications mustcallsbrk(), but need to call other library routines that might callmalloc. The algorithms used by these functions are not sophisticated. Thereis no reclaiming of memory.
Themalloc() andfree() functions provide a simple general-purpose memory allocation package.
Themalloc() function returns a pointer to a block of at leastsize bytes suitably aligned for any use.
The argument tofree() is a pointer to a block previously allocatedbymalloc(),calloc() orrealloc(). Ifptr is aNULL pointer,no action occurs.
Undefined results will occur if the space assigned bymalloc() is overrunor if some random number is handed tofree().
Thecalloc() function allocates space for an array ofnelem elements ofsizeelsize. The space is initialized to zeros.
Therealloc() function changes the size of the block pointed to byptr tosize bytes and returns a pointer to the (possibly moved)block. The contents will be unchanged up to the lesser of thenew and old sizes. If the new size of the block requires movementof the block, the space for the previous instantiation of the blockis freed. If the new size is larger, the contents of thenewly allocated portion of the block are unspecified. Ifptr isNULL,realloc() behaves likemalloc() for the specified size. Ifsize is 0 andptr is not a null pointer, the space pointed to is freed.
Each of the allocation functions returns a pointer to space suitably aligned(after possible pointer coercion) for storage of any type of object.
Themalloc() andrealloc() functions will fail if there is not enoughavailable memory.
Entry points formalloc_debug(),mallocmap(),mallopt(),mallinfo(),memalign(), andvalloc() are emptyroutines, and are provided only to protect the user from mixingmalloc()functions from different implementations.
If there is no available memory,malloc(),realloc(), andcalloc() return anull pointer. Whenrealloc() returnsNULL, the block pointed to byptris left intact. Ifsize,nelem, orelsize is 0, a unique pointerto the arena is returned.
Seeattributes(5) for descriptions of the following attributes:
|
brk(2),getrlimit(2),mmap(2),realloc(3C),malloc(3MALLOC),attributes(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |