2. Memory
Memory is the processes by which
information is encoded, stored and
retrieved. Encoding allow information
that is from the outside world to reach
our senses in the forms of chemical and
physical stimuli.
3. Allocation
An alloation is something that you
set aside for use .for instance if you
want to set aside a certain amount
of hard drive space for an
application,you can allocate how
much in the settings
4. MEMORY ALLOCATION
The placement of blocks of information in a
memory system is called memory allocation.
To allocate memory it is necessary to keep in
information of available memory in the system.If
memory Management system finds sufficient free
memory,it allocates only as much memory as
needed ,keeping the rest available to satisfy future
request .
If sufficient memory is not available, swapping of
blocks is done.
6. Static memory alocation
In static memory allocation, size of the
memory may be required for the
calculation that must be define before
loading and executing the program.
7. DYNAMIC MEMORY ALLOCATION
In the Dynamic memory allocation , the
memory is allocated to a variable or
program at the run time.
The only way to access this dynamically
allocated memory is through pointer
9. We cover the topics-
Malloc( )
Calloc( )
Realloc( )
Free( )
10. Malloc( )
The declaration of malloc ( ) function is
Void*malloc(size_t size)
The malloc function allocates a block of size bytes from
the memory heap.
It allows a program to allocates memory as it’s needed
and in the exact , amount needed.
11. Return values of malloc( )
On success malloc return a pointer to the
newely allocated block of memory.
On error malloc return null.
If the argument size=0,malloc return null.
12. Calloc( )
The declaration of calloc ( ) function is –
void *calloc(size_t n items , size_t size)
Calloc provided access in c memory
heap.which is available for dynamin
allocation of variable size block of memory.
13. Realloc( )
The declaration of realloc ( ) function is-void
*realloc(void*block size_t size);
Realloc adjust the size of allocated block to size , copying
the contents to a new location if necessary.
If block pointer is null pointer , realloc works just like
malloc.
14. Free
The declaration of free ( ) function is-
Void free(void*block)
It release allocated block of memory .
Free de-allocates a memory block allocated
by a previous call to calloc.malloc,realloc.