When a new {@link ReferenceCounted} is instantiated, it starts with the reference count of {@code 1}. {@link #retain()} increases the reference count, and {@link #release()} decreases the reference count.If the reference count is decreased to {@code 0}, the object will be deallocated explicitly, and accessing the deallocated object will usually result in an access violation.
If an object that implements {@link ReferenceCounted} is a container of other objects that implement{@link ReferenceCounted}, the contained objects will also be released via {@link #release()} when the container'sreference count becomes 0.
|
|