Monday, March 23, 2020

Dynamic Memory Allocation in C++


C++ Dynamic Memory Allocation is different from that seen in the C. While C uses functions like malloc(), calloc(), realloc() and free() to handle operations based on DMA, C++ also uses all the 4 functions in addition to 2 different operators called new and delete to allocate memory dynamically.

These statements are indicative of the fact that DMA is implemented by the programmer itself. C++ lacks the feature of a garbage collector which automatically helps to free up unnecessary memory space occupied by stagnant garbage values.

It is important to note that the memory is dynamically allocated on the Heap. The non-static memory and local variables get memory allocated on Stack.

23 comments:

  1. Useful blog for learning programming

    ReplyDelete
  2. It was worth reading ..... Important information is explained with a lot of simplicity πŸ™ŒπŸ™ŒπŸ™ŒπŸ™Œ

    ReplyDelete

DOCUMENTATION

Course project Title:      Implementation of Family tree Using Generalized Link List Description:    In this project we have create...