0% found this document useful (0 votes)
56 views1 page

Life Time of Data Object

The lifetime of data objects is determined by their visibility - global objects last the duration of the program runtime, while local objects only persist within the module call. However, declaring local objects with the STATICS statement extends their lifetime to the entire program like global objects, though visibility remains within the module.

Uploaded by

Debebook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views1 page

Life Time of Data Object

The lifetime of data objects is determined by their visibility - global objects last the duration of the program runtime, while local objects only persist within the module call. However, declaring local objects with the STATICS statement extends their lifetime to the entire program like global objects, though visibility remains within the module.

Uploaded by

Debebook
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

The lifetime of a data object is usually linked with its visibility.

Global data objects remain valid as long as the corresponding program is in the memory.

The lifetime of object attributes begins when the object is instantiated at runtime and ends
when the last reference to the object has been deleted.

The lifetime of a local data object is usually identical to the lifetime of the surrounding
modularization unit, which means the contents of the data object are lost between two calls of
the same modularization unit.

Hint: If you use the STATICS statement instead of DATA when you declare local data
objects, the system extends their lifetime to the overall program lifetime. Therefore, these
such data objects have the same lifetime as global data objects, but their visibility is still
limited to the respective modularization unit. You can use the STATICS statement in
function modules, subroutines, and static methods.

You might also like