why release memmory?
Well, if you set them to NULL you can easily check later if you have memory allocated or not.
Calling delete on a NULL pointer is guaranteed to fail gracefully, eg do nothing at all. If you call delete on a pointer, fail to set it to NULL, and try to delete the same pointer once more, lots of bad and mysterious things can and will happen.
Personally I believe garbage collection is the future for all but the most time critical programs. I''m also getting a little tired of that silly l33ter-than-thou-because-I-manage-my-own-memory attitude.
"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts
Personally I believe garbage collection is the future for all but the most time critical programs. I''m also getting a little tired of that silly l33ter-than-thou-because-I-manage-my-own-memory attitude.
"I contend that we are both atheists. I just believe in one fewer god than you do. When you understand why you dismiss all the other possible gods, you will understand why I dismiss yours." - - Stephen Roberts
Another reason to relase the memory is so that you can use the same physical memory again and again, instead of always asking for more when you need it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement