OK, fine.

That's something important to know then.

If my website is made of hundreds of different pages, then, I should better ensure that lexical variables are properly freed up.

Even if that's not good programming practive, at least, with global variables, we are sure that the same memory locations are used across different scripts. (which is not the case with lexical variables)

Thanks for all your help, I now have a clearer picture.

Lionel.

----- Original Message ----- From: "Perrin Harkins" <[EMAIL PROTECTED]>
To: "Lionel MARTIN" <[EMAIL PROTECTED]>
Cc: <modperl@perl.apache.org>
Sent: Friday, May 11, 2007 12:29 AM
Subject: Re: After retrieving data from DB, the memory doesn't seem to be freed up


On 5/10/07, Lionel MARTIN <[EMAIL PROTECTED]> wrote:
So, to sum up, if I have got 10 different scripts in a mod perl environment (let's call them test1.pl....test10.pl), and using lexical variables there. If I first run test1.pl and then, run test2.pl, the only way for test2.p to
get access to the memory used by test2.pl is freeing up test1.pl lexical
variables, by undefining them?

Yes.

And what if I run test1.pl twice without undefining its lexical variables?
Will the same memory space be used twice, or will each call use different
memory space (I'm talking here about situation where the same Perl
interpreter is running the script twice in a mod perl environment)?

It will reuse the already allocated memory.  And the second pass is
faster because the memory is already allocated.

- Perrin


Reply via email to