D - How is 'delete' implemented?
- Jeroen van Bemmel (2/2) Mar 07 2003 Is it a hint to the garbage collector to do a check, starting with the
- Walter (8/10) Mar 07 2003 No, it isn't a hint to the gc. It instructs the gc to run the destructor...
Is it a hint to the garbage collector to do a check, starting with the object on which delete is called?
Mar 07 2003
"Jeroen van Bemmel" <anonymous somewhere.com> wrote in message news:b4amd9$25ai$1 digitaldaemon.com...Is it a hint to the garbage collector to do a check, starting with the object on which delete is called?No, it isn't a hint to the gc. It instructs the gc to run the destructor (if any) on the object, and then mark the object as 'free'. The gc does not do any checks. If you left any dangling pointers to it, you've got a pointer bug. As such, delete is a more advanced technique and should be used with caution. It's in the language so people can tune their code for performance.
Mar 07 2003