Weak References and Finalization

Created on 2020-07-31T22:07:34.600459

Return to the Index

This card pertains to a resource available on the internet.

This card can also be read via Gemini.

Reference: A marker which says an object is still in use. These are counted and something is deleted when it no longer has any references to it.

Weak Reference: A marker which references an object but does not "count" as a reference. When the object it references is deleted the weak reference is replaced with a tombstone. Allows an object to reference another without keeping it alive.

Finalizer: A piece of code which is run when an object is deleted because it no longer has any references to it.

The appropriate time to use a finalizer is when an object holds external resources.

Dolphin Smalltalk