1.

Explain The Concept Of Memory Leak.

Answer»

When a variable does not exist longer in the memory, and deletion or reuse of that variable cannot be done, then its DESTRUCTION occurs AUTOMATICALLY. This concept is called memory LEAK.
For example, CONSIDER the following code snippet:

{ parent*p=new parent(); }

In the preceding code snippet, the p variable does not exist in the memory, but the variable is not deleted. Therefore, it becomes out of scope and its destruction occurs, which RESULTS in memory leak.

When a variable does not exist longer in the memory, and deletion or reuse of that variable cannot be done, then its destruction occurs automatically. This concept is called memory leak.
For example, consider the following code snippet:

In the preceding code snippet, the p variable does not exist in the memory, but the variable is not deleted. Therefore, it becomes out of scope and its destruction occurs, which results in memory leak.



Discussion

No Comment Found