On 2/2/06, Pine Yan <[EMAIL PROTECTED]> wrote:
>
> Hi, what happens to the memory space with the following code:
>
> my @full_list = ();
>
> if (...) {
>   my @tmp_list;
>   @tmp_list = split(...);
>   @full_list = (@full_list, [EMAIL PROTECTED]);
> }
>
>
> Here @tmp_list is a local variable and its definition terminates at the
> end of this code segment. Does this mean the
> memory space it occupies will be freed, too? If yes, what will happen to
> the reference of that variable stored in @full_list?
>
> Thanks.
>
> Sincerely
> Pine

Perl uses reference count garbage collection.  This means that as long
as a reference to the memory that was allocated by my exists it sticks
around.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to