Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

memory(3) [freebsd man page]

MEMORY(3)						   BSD Library Functions Manual 						 MEMORY(3)

NAME
malloc, free, realloc, calloc, alloca, mmap -- general memory allocation operations LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> void * malloc(size_t size); void free(void *ptr); void * realloc(void *ptr, size_t size); void * calloc(size_t nelem, size_t elsize); void * alloca(size_t size); #include <sys/types.h> #include <sys/mman.h> void * mmap(void * addr, size_t len, int prot, int flags, int fd, off_t offset); DESCRIPTION
These functions allocate and free memory for the calling process. They are described in the individual manual pages. SEE ALSO
mmap(2), alloca(3), calloc(3), free(3), malloc(3), realloc(3) STANDARDS
These functions, with the exception of alloca() and mmap() conform to ISO/IEC 9899:1990 (``ISO C90''). BSD
June 4, 1993 BSD

Check Out this Related Man Page

MEMORY(3)						   BSD Library Functions Manual 						 MEMORY(3)

NAME
alloca, calloc, free, malloc, mmap, realloc -- general memory allocation operations LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> void * alloca(size_t size); void * calloc(size_t nelem, size_t elsize); void free(void *ptr); void * malloc(size_t size); void * realloc(void *ptr, size_t size); #include <sys/mman.h> void * mmap(void * addr, size_t len, int prot, int flags, int fildes, off_t off); DESCRIPTION
These functions allocate and free memory for the calling process. They are described in the individual manual pages. LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/mman.h> void * mmap(void * addr, size_t len, int prot, int flags, int fildes, off_t off); The include file <sys/types.h> is needed for this function. COMPATIBILITY
mmap() now returns with errno set to EINVAL in places that historically succeeded. The rules have changed as follows: o The flags parameter must specify either MAP_PRIVATE or MAP_SHARED. o The size parameter must not be 0. o The off parameter must be a multiple of pagesize, as returned by sysconf(). SEE ALSO
mmap(2), alloca(3), calloc(3), free(3), malloc(3), realloc(3), compat(5) STANDARDS
These functions, with the exception of alloca() and mmap() conform to ISO/IEC 9899:1990 (``ISO C90''). BSD
June 4, 1993 BSD
Man Page

15 More Discussions You Might Find Interesting

1. Programming

problem deallocating memory for 3d aray

Can anyone tell me why this section of code causes a segmentation fault when 'deallocate' is called?. Although it works when n>=number. This code segment is intended to be used in a program in which the tensor is very large, (5x512x512) or greater. i tryed to compile this using gcc version... (2 Replies)
Discussion started by: bongobonga
2 Replies

2. UNIX and Linux Applications

Looking for memory leaks freeware tools

Hello all Is there good free ware tools to check software memory leaks ? Some thing like purify on unix platforms sun/hp/linux Thanks (3 Replies)
Discussion started by: umen
3 Replies

3. Solaris

Sun Blade 100 Memory Upgrade

Hi, I've been a member for a while but have never posted. I have a Sun Blade 100 desktop and I just installed Solaris 10 and it is unbearably slow. I only have 128 Meg of RAM and need to upgrade. I have searched and found many online resources that have RAM, but I was wondering if anyone has... (12 Replies)
Discussion started by: BrewDudeBob
12 Replies

4. Shell Programming and Scripting

CUP and Memory

Hi All Unix experts, I want to calculate CUP Utilization and Memory Utilization on solairs boxes. Please help me to write a script for this, since i am doing this manualy for more than 30 servers daily. My daily task is # top last pid: 28627; load avg: 8.50, 8.12, 8.16; up... (4 Replies)
Discussion started by: bullz26
4 Replies

5. Shell Programming and Scripting

Memory usage of a process

hi all, i want to write a script that checks the memory usage of processes and send a mail with the name of the process witch is using more then 300mb RAM. dose anybody have a sample script or an idea how i can make it ? PROCCESSES="snmpd sendmail" for myVar in $PROCCESSES do ... (7 Replies)
Discussion started by: tafil
7 Replies

6. Programming

Measuring memory used by a program?

I have a Java program. I want to measure the total memory used by the program, especially the peak memory. Is there a way to do it? I have tried utilities like time (which returns 0) and top (which is not very useful) as the program does not run for long. Can anyone suggest a way to do this?... (5 Replies)
Discussion started by: spathical
5 Replies

7. Solaris

real memory consumption of a process

hi pmap, prstat and ps gives the RSS which is shared memory. I need to know the consumption of real memory. how to do that? thx (4 Replies)
Discussion started by: melanie_pfefer
4 Replies

8. Programming

Write into shared memory segments

I have created a shared memory segment (which size is 64 bytes) using shmget, shmat e.t.c and i want to divide it into 2 areas. One area for input data and one area for output? How can i do that? Furthermore, When i have to write my input data into the shared memory segment i want to write... (3 Replies)
Discussion started by: mae4
3 Replies

9. Programming

allocate memory for the same struct: sometimes successful, sometimes failure, why

It is customary to use structs in c code. but it is suprising to obtain different results. Sometimes a pointer is returned. But a failure would appear at other attempts. e.g. struct _site { int type; char A; char B; . . ... (12 Replies)
Discussion started by: cdbug
12 Replies

10. Solaris

Memory usage in Solaris - memory not freed?

Hi, I'm running a multi-process software system on a Solaris 8 machine. When I monitor the memory usage, I see that the free memory is dropping rapidly, but I can't detect a process that uses this memory. I'm using "top" to get the free memory and the memory usage of processes. Thanks. (3 Replies)
Discussion started by: gewurtz
3 Replies

11. Solaris

Page cache too large

I have a solaris10 box running a java application on it. Whenever the java app is used heavily, the amount of free memory decreases fairly rapidly. I believe I have eliminated the running applications from the culprit list. In the process I have found that the page cache is consuming about 20G... (4 Replies)
Discussion started by: timothy.edwards
4 Replies

12. Solaris

Physical and Free mem on TOP command

Hi, When I run the free command on solaris, I get the following: "Memory: 60G phys mem, 69G free mem" Q: how cna the free mem be higher then the physical mem?:confused: Amit (3 Replies)
Discussion started by: amitlib
3 Replies

13. Shell Programming and Scripting

My script seems to eat too much memory

Hey there, I am currently learning shell scripting. My first script is a 4chan image downloader, which so far works, but seems to be a memory eater. My Raspberry Pi 2 (1GB RAM) needs to swap sometimes. The free RAM quickly goes down from 700 MB to zero. I don't know the cause, but it would be... (3 Replies)
Discussion started by: anominous
3 Replies

14. Red Hat

RHEL Memory issue

Friends, I have 8CPU/24gb RAM in my Linux servers around 30+. All the servers are running with Java based application with NFS mounted. The problem what I have is, When I reboot servers the server memory looks decent. But after some time the "cached" memory increasing and "free" memory... (5 Replies)
Discussion started by: baluchen
5 Replies

15. Solaris

Where is my memory? How to fix it ?

Hello, I have few Solaris 11.2 servers. Since sometime, we are noticing high memory utilization in them. Here is current config root@ser22-zonemgr:~# /tmp/memory.sh Physical memory size: 36864 Memory usage in MB: 32938 Memory usage in %: ... (4 Replies)
Discussion started by: ron323232
4 Replies