Probably you notice that you have +- 1kb for each hexa values. This seems that you have some global variables that are not necessary.
Usually the solution is having the variables scoped to the minimum code area possible. Module 'strict' can help. for instance if you have something like. my @array; foreach (...) { ... } ... Code1 ... ... Code2 ... and the @array is just used inside the array and in the Code1 area, this shall be better. { my @array; foreach (...) { ... } ... Code1 ... } ... Code2 ... Is ugly but with big data struts, frees the unnecessary memory. I don't know for sure the effect of: @out_array_bin = map {""} (@out_array_bin); instead of for ($init_cnt=0;$init_cnt<=$#out_array_bin;$init_cnt++) { $out_array_bin[$init_cnt] = ""; } But is more readable. Probably better then evrithing is not having the 786432 values on the memory. Marcos > -----Original Message----- > From: Hari Krishnaan [mailto:[EMAIL PROTECTED] > Sent: Monday, May 24, 2004 9:38 PM > To: [EMAIL PROTECTED] > Subject: Question of memory management in Perl > > > 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 did 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 > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>