What is a memory leak & what are its consequences? Is it necessary to deallocate heap memory? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

What is a memory leak & what are its consequences? Is it necessary to deallocate heap memory?

why is a memory leak called a 'leak'? is memory deallocation necessary only for a large program?...

13th Sep 2018, 5:28 PM
Sushank Mishra
Sushank Mishra - avatar
5 Antworten
0
Sushank Mishra it's not necessary to do deallocation for large program... fact is that you may observe issue in large program due to more unutilized memory.... one should go with deallocation of heap memory after usage... leak terminology is due to fact that it is wastage... you can't use is properly... memory leak also say same thing that you have allocated memory and used it... but as you have not deallocated, it's free and of know use, but you cannot reuse it... why ?? because once allocated memory is not available to be utilised unless you deallocate
13th Sep 2018, 6:28 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
if the memory once allocated on the heap,if not deallocated by the program, then the same memory location can't be used for other programs?
14th Sep 2018, 7:44 AM
Sushank Mishra
Sushank Mishra - avatar
0
or is it that even after using the dynamic memory allocation, the compiler will never provide the other programs with that memory location?
14th Sep 2018, 7:46 AM
Sushank Mishra
Sushank Mishra - avatar
0
if that is the case are there any safeguard with the OS or any other system component which handles the junk memory locations on the heap?
14th Sep 2018, 7:47 AM
Sushank Mishra
Sushank Mishra - avatar
0
it crashes memory and parent application is closed , memory allocated is free now..
14th Sep 2018, 10:15 AM
Ketan Lalcheta
Ketan Lalcheta - avatar