[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] 'my' memory leak?



One thing about 'my' is that references to 'my' variables
can "continue to exist" after the context in which the variable
was created. This is necessary with Perl5's new referenced
variable paradigm. Thus, certainly, if you are maintaining
a reference to the 'my' variable, then it will not be free-ed.

If you are not maintaining a reference, then I am not sure
what the rules are. However, it could be that within the context
you are using, each 'my' variable will be maintained until the
completion of the next highest context, which might explain
your observation.

This is the single most important difference between 'my' and 'local'.

In Regards to your letter <v01540b00ad8b013a7a24@[158.152.16.253]>:
> >From my reading of the documentation of 'my', I might expect problems if
> subroutines were called recursively, and the recursion got out of hand, but
> this doesn't seem to be the case - I don't have any recursive calls. It
> looks to me as if either 'my' leaks, or there's something special about
> using object methods within a 'while' loop. My loop construct is:
> 
>         while($parser->next($entry)) {
> 
>                 # ... do stuff ...
> 
>         }


tim.

time@ice.com  (UUCP: heifetz!tbomb!time)

USENET - a slow moving self parody... ph