+ 1
In dynamic memory allocation if we will not deallocate memory using delete operator in c++ then what will happen ???
C++
4 Réponses
+ 2
Thanks to all
0
Then you have memory leak in your program, in C++ use Smart pointers like std::shared_ptr instead of raw pointers.
0
If you deleted the pointer to the memory somehow then that memory will stay as allocated and will be inaccessible causing a memory leak. This leak is fixed when the progam exits or a system reboots.
As per your question, the memory remains allocated until you delete it or the process finishes and causes memory leak.