Answer to Question #187087 in C++ for Pronoy

Question #187087

Explain the following:

a)     Memory Leak

b) Dangling Pointer  


1
Expert's answer
2021-04-29T19:08:55-0400

a) A Memory leak occurs when memory is allocated and then never released. If the code’s active lifespan is very short, it’s usually not a huge issue. However, if the code is expected to keep running, a memory leak can eventually cause the system’s memory to be entirely clogged with memory that has been allocated but is no longer actively in use.


b) A dangling pointer is a pointer that was used to point at a dynamically-allocated block of memory which has subsequently been de-allocated, but the pointer remains. If that pointer is then referenced, the memory might still contain what it used to contain, or it might have been re-allocated to something else.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS