Should I aggressively release memory while reading a file, line by line?
An example:
while (<FILE>) {
my $line = $_;
<process line>
undef($line);
}
“Undefing” the $line variable is a good option for reducing memory consumption?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That should make no difference as the variable will be released as soon as the next loop iteration starts, whether you explicitly undef it or not.