Glossary: Memory Leak

OO programs are dynamic; the objects they consist of are created and destroyed throughout the course of the program execution. Objects require memory to hold their data members. The memory for objects created at execution time comes from the stack or the heap. When objects are destroyed it is essential that the memory that they occupied is recovered. This is automatic for stack based objects, but is left to the application code for heap based objects. Failing to destroy objects correctly by using the delete operator results in memory clogged with dead objects, a phenomenon referred to as a memory leak. Deleting an object more than once can cause a program to crash; objects should only be deleted by their owners. Memory leaks can result when there is no clear owner of an object.
Go Back to the The Glossary Top Page

If you have any comments about this page please send them to Nick West