<P> Destroying an object will cause any references to the object to become invalid, and in manual memory management any existing references become dangling references . In garbage collection (both tracing garbage collection and reference counting), objects are only destroyed when there are no references to them, but finalization may create new references to the object, and to prevent dangling references, object resurrection occurs so the references remain valid . </P> <P> Related Languages: "Delphi", "Free Pascal", "Mac Pascal". </P> <P> Socket will be closed at the next garbage collection round, as all references to it have been lost . </P>

When is an object created and what is its lifetime