This post will not tell you how to find and fix your memory leek but I intend to show you the most common cause of a memory leek.
A memory leek happens when you delete a pointer, but don’t delete the memory it is pointing to. Pointers are created with an *, like the following.
A pointer points to a position in memory, and the computer allocates the space for the value you as a programmer put into the pointer. If you delete the pointer, without first telling the computer you no longer needed the allocated space, you will never be able to access that space. The computer will not use that space because it thinks that you are using it.
It would be like if you parked your car in a city and then forgot were you parked it. No one else would be able to park in the space because your car is there but you are not using the car. The space is not being used in a constructive way and there is no way for you to access it therefore it is a memory leek.
So remember every time you create a pointer don’t delete the pointer without deleting the data it points to first.
Copy right Britney Lee Johnson September 2010.