Professional Documents
Culture Documents
Techniques
Submitted By:-
Submitted To:
Cherry Khosla
First of all I would like to thank the Lovely Professional University, and take
the opportunity to do this as a part of the B-TECH
Many people have influenced the shape and content of this term paper, and
many supported me through it. I express my sincere gratitude to “Cherry
Khosla” for assigning me a term paper on “Dynamic Storage Allocation
Techniques “.
She has been an inspiration and role model for this topic. Her guidance and
active support has made it possible to complete the assignment.
I also would like to thank my Friends who have helped and encouraged me
throughout the working of the project.
Finally, I take this opportunity to acknowledge the services of the total team of
publisher and everyone who collaborated in producing this work.
2. Methodology used:
Compiler allocates space for all variables (local and global) of all
procedures at compile time.
No stack/heap allocation.
No overheads.
No recursion.
Some processors families, such as the x86, have special instructions for
manipulating the stack of the currently executing thread. Other processor
families, including PowerPC and MIPS, do not have explicit stack support,
but instead rely on convention and delegate stack management to the
operating system's application binary interface (ABI).
Memory allocating using Heap:
Blocks of memory allocated on the heap are actually a special type of data
structure consisting of
(3) the allocated block of memory which can vary in size depending on
its use
, (4) a pointer to the beginning of this block, and
The functions malloc (), realloc (), calloc () and free (),
the Library functions stdlib.h, malloc.h or are responsible for this task. All
data are stored in the free store (heap), which is limited to 64k a stack in
the beginning, this varies from machine. All variables were declared so far
on the stack, now you tell me where to go, in an indirect way.
Format is as follows.
Specifies in bytes the size of the area you want to reserve the argument.
It returns the address as the return value of the dynamically allocated
area. In addition, returns NULL if it fails to secure the area. The failure to
ensure that the situation is usually that is out of memory.
The return type is of type void *, also receive the address of any type.
The fact is used as follows.
calloc() function
Realloc()
With the function realloc, you can change the size of the allocated area
once. Has the following form.
Free() function:
how to release the reserved area, which will use the function free. Has
also been declared in stdlib.h, which has the following form.
By using new:
allocation. A call to delete, which calls the destructor and returns the
memory allocated by new back to free store, must be made for every call
to new to avoid a memory leak.
Syntax:
3. Results:
5. References
http://en.wikipedia.org/wiki
http://www.cprogrammingexpert.com
http://www.cs.fsu.edu