For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > May 2004 > Question of memory management in Perl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Question of memory management in Perl
Hari Krishnaan

2004-05-24, 7:30 pm

Hi all,
I have question with respect to memory utilization using perl. I am reading a huge file close to 786432 lines of hex values & am storing in an array. I do a data reformatting using the data in these array & in the sequence of process generate a number of
arrays & eventually write into a file at the end of the subroutine. The problem I get is in the middle of subroutine execution I get "Out of memory" indication & I have used close to 2 Gigs of memory. So inorder to avoid this Out of memory issue what I di
d was, after I send the array elements to a different array, I initialize the original array with null. For eg: this is what I do with one of the array,

for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) {
$out_array_bin[$init_cnt] = "";
}

I followd the same approach with other arrays in my subroutine.
I thought this would solve my Out of memory problem but it did not.
Can some one tell me what could be an alternative solution for this problem or kindly suggest me if sometning I should need to correct in my existing solution.

Thanks for the help in advance,
Hari





---------------------------------
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com