Storage Allocation

The storage allocation represents memory management. The allocation of memory can be done in the following ways:

  1. Static Allocation
  2. Stack Allocation
  3. Heap Management

Static Allocation:

It is a procedure used for the allocation of all data objects at compile time. This type of allocation is possible only when the compiler knows the data object’s size at compile time. The following points must be considered in this type of allocation:

  • Names are bound to storage in static allocation.
  • Names are bonded to a fixed location.
  • A run-time support package is not required.
  • The compiler decides the size of storage and place for names.
  • It does not support recursion procedure.

Stack Allocation:

It is a procedure in which a stack is used to organize the storage. The stack used in this allocation is called a control stack. The following points must be considered in this type of allocation:

  • Procedure, functions or methods are managed by means of stack memory allocation.
  • It works in the last-in-first-out (LIFO) method.
  • It is used for the recursive procedure call.

Heap Allocation

  • The most flexible allocation scheme is heap allocation.
  • It is used to dynamically allocate the variables and calls back when the variable is not in use.
  • It is dynamic in nature so that a user can allocate and deallocate according to their needs.
  • It supports the recursion process.

Pin It on Pinterest

Share This