General Discussions

Stack and Heap Memory

PH's avatarPH Bytes

Stack Memory

Heap Memory

Memory allocated is in LIFO fashionNo specific order. Is random.
Allocation and de-allocation of memory is automaticAllocation and de-allocation of memory is manual
Locality of reference is excellentLocality of reference is adequate
Memory allocated is of fixed size and is not flexibleResizing is possible
Space is efficiently managed by CPU, memory will not be fragmentedNo guaranteed efficient use of space. Memory may be fragmented over time as blocks of memory are allocated, then freed.
Implementation is hardImplementation is easy
Access time is fasterAccess time is slower

View original post

Let me Know What you Think!