+ 1

What does this line mean?!

Forgetting to free up memory that has been allocated with the new keyword will result in memory leaks, because that memory will stay allocated until the program shuts down.

28th May 2017, 5:53 PM
Souvik Chatterjee
Souvik Chatterjee - avatar
3 Answers
+ 5
While talking of pointers in C++, you know they allocate some memory to themselves. A very large no. Of such allocations may result in memory leaks. A memory leak is a type of resource leak that occurs when a computer program incorrectly manages memory allocations in such a way that memory which is no longer needed is not released. In object-oriented programming, a memory leak may happen when an object is stored in memory but cannot be accessed by the running code. So it is always a good practice to free up the allocated memory when it is not needed.
28th May 2017, 6:47 PM
Syed Hamza Ali
Syed Hamza Ali - avatar
+ 3
also in the newer versions of c++ they have created so-called smart pointers which take on to the job of freeing up memory themselves, they are very much recommended to use over raw pointers
28th May 2017, 8:12 PM
‎ɐısıօՏɐ
‎ɐısıօՏɐ - avatar
0
kool
7th Jun 2017, 4:40 PM
But Mad
But Mad - avatar