Perl Programming Question: Download Perl Programming PDF

What happens to objects lost in "unreachable" memory..... ?

Tweet Share WhatsApp

Answer:

What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?

Their destructors are called when that interpreter thread shuts down.
When the interpreter exits, it first does an exhaustive search looking for anything that it allocated. This allows Perl to be used in embedded and multithreaded applications safely, and furthermore guarantees correctness of object code.

Download Perl Programming PDF Read All 46 Perl Programming Questions
Previous QuestionNext Question
When would local $_ in a function ruin your day?Assume that $ref refers to a scalar, an array, a hash or to some nested data structure. Explain the following statements: