Skip to main content

Posts

Showing posts from June, 2021

Object Lifetime and Storage Duration

Introduction: While creating an object, its location in memory has to be established, before it is initialized. Initialization means putting value into the location. The lifetime of an object starts just after initialization. When an object dies, its location (storage), which the object occupied is released and then the computer is shut down or the storage is taken up (used) by another object. Releasing a storage means, making the identifier or pointer that occupied the storage, invalid. The lifetime of an object ends, when its storage is released. Some time is needed to create an object. Some time is needed to kill an object. When talking about an object, two things are involved: the location which is the storage, and the value. The meaning of lifetime and storage duration are similar; but the duration is seen more from the point of view of the location than from the point of view of the value. The storage duration is the time from when a location is associated to an object to the tim...