Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
One Perl interpreter instance will be created in C code and the subroutine Process will be called many times. My questions is what will happen to the memory allocated by the subroutine FormData?. I think all the memory allocated by the subroutine FormData will not be freed across the calls to the subroutine Procees and destroyed only when the perl Interpreter instance is destroyed ( When the C program Exits). Is there any way to free the memory allocated by the subroutine FormData when the subroutine Process exits every time. Thanks.package UserScript; sub Process { my (@List); $List[0] = FormData("George",70); $List[1] = FormData("Mike",54); $List[2] = FormData("Crieg",37); } sub FormData { my($UserData) = {}; $UserData->{name} = $_[0]; $UserData->{Age} = $_[1]; # Doing some processing. return $UserData; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Garbage Collection
by Fastolfe (Vicar) on Jan 05, 2001 at 19:59 UTC | |
|
Re: Garbage Collection
by mrmick (Curate) on Jan 05, 2001 at 19:27 UTC | |
|
Re (tilly) 1: Garbage Collection
by tilly (Archbishop) on Jan 05, 2001 at 20:16 UTC | |
|
Re: Garbage Collection
by ChOas (Curate) on Jan 05, 2001 at 19:18 UTC | |
|
Re: Garbage Collection
by kschwab (Vicar) on Jan 05, 2001 at 19:24 UTC |