I thought that the delete command would free up memory I allocated. Can someone explain why it seems I still have the memory in use after delete?
class Test
{
pu
As others have said, what you've done is wrong, but you can't expect any particular behavior.
What's probably happening on most modern systems is the memory allocated for and occupied by e
is on a memory page mapped as valid for your program, and the fact that you have delete
d e
, doesn't not undo that mapping.
So you are still accessing memory that your application has permission to use from OS. Thus, no segmentation fault. It is possible, however that if enough things happen between delete e
and accessing that memory the page will have been remapped. Then you get a seg fault.