in reply to Out of memory issue

1. I think you need to change the extension of ur image file to either JPG for processing the file or

2. possibly since it is going out of memory then try using less expensive methods to read the file in the directory i.e. rather than reading the entire file into an array read it line by line. I am not sure how it works with image file but I am sure there will be some methods to do that.

3. empty the arrays or hash or the any data structure whichever you are using after using it rather than over witing it.

Good Luck !!

1. I understand what desemondo (Friar) is saying but, my intention was that we can reduce the time for doing the manipulations with the file by converting into JPG and see if it is working fine or not. 2. Empty the data structures means that in case you are doing the push or shift operations then it will take a lot of time as compared to using the same in smaller parts.

Replies are listed 'Best First'.
Re^2: Out of memory issue
by desemondo (Hermit) on Mar 19, 2010 at 02:25 UTC
    " I think you need to change the extension of ur image file to either JPG for processing the file "
    Why do you think that? Isn't a file just a file, even on Windows? All the extension does is allow windows to know what viewer/editor/or program to associate and/or launch when you double click that file? I don't see how the extension could affect reading the file...

    "empty the arrays or hash or the any data structure whichever you are using after using it rather than over witing it."
    Is this what you mean by that?
    my @images = qw(file1.png file2.png file3.png); @images = (); @images = qw(file4.png file5.png file6.png);
    If so, why is that better than this?
    my @images = qw(file1.png file2.png file3.png); @images = qw(file4.png file5.png file6.png);

    Update:
    Perhaps you meant that you need to empty your data structure periodically if you are pushing or unshifting onto it, as it would continue to grow otherwise?