hi,
what is memory leak? n wht is the difference between a stack n a heap?
ranjita
hi,
what is memory leak? n wht is the difference between a stack n a heap?
ranjita
In computer science, a memory leak is a particular kind of unintentional memory consumption by a computer program where the program fails to release memory when no longer needed. The term is meant as a humorous misnomer, since memory is not physically lost from the computer, but rather becomes claimed but ignored due to program logic flaws.
Traditionally in a process address space you would see stack growing upside down and heap growing upwards. An application wise difference is all the memory allocated dynamically gets allocated on heap viz. malloc free, calloc etc. The stack of an process contains stack frames( containing the return address linkage for a function and the data required in a stack which has the qualifier 'auto').
Efficiency-wise, one thing I can think of is memory on stack should be a bit faster to access as the hit-ratio for the pages having stack memory should have a better chances in terms of cache and also virtual memory. There should be a few more here, which can be same as choice of using array vs new().
program logic flaws - mostly while handling memory dynamically
fastness - stack r heap depends on the appln ....
vast research is going on 2 make the time complexity as o(1) ...
C or C++ gives flexiblity to get memory dynamically from system stack,
this dynamically taken memory will not be released it is by explictly...though it is no longer useful....in other terms this is wasting memory space without any use...
if memory leaks grows there will be no space for normal program execution...
this causes serious problems in complex applications...
There are currently 1 users browsing this thread. (0 members and 1 guests)