int *p = new int;
delete  p;
The above sort of code is giving me major hassle! I'm using a 2d array of pointers and can't seem to free up the memory space that it is occupying when I delete it.
The pointer is set to NULL all right, but the data it used to point to is still there. I discovered this when I put another pointer pointing to the same data:
int *q = p;
After deleting p, q still points to the two integers in memory.
This is really frustrating as it seems to have loads of implications. What if I had a linked list of 5000 records and decided to delete it? Would the memory ever be freed up?! Please help!
I'm programming in Emacs,Linux