Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^5: Out of memory error!!!

by McA (Priest)
on Mar 28, 2013 at 10:23 UTC ( #1025927=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Out of memory error!!!
in thread Out of memory error!!!

How much data do you have to collect to decide in which order you can generate the xml? Do you have to collect all records of the input file? Do you only have to collect a sequence of segments to create a - let's call it - xml record? Sorry, but your excerpt didn't help?

How big is the input file?

McA


Comment on Re^5: Out of memory error!!!
Re^6: Out of memory error!!!
by sathya83aa (Acolyte) on Mar 28, 2013 at 13:27 UTC

    I have to collect data from all the lines in the input file and then print it to the XML file.

    Actually the input file is huge,..but now for testing we are using a input file with 30 lines for which we are getting the error.

      ... while (defined(my $line2 = $INFO)) { ...

      ... you need to use the diamond operator to read from a file line by line:

      ... while (defined(my $line2 = <$INFO>)) { ...

      First of all. 30 lines mean nothing when you don't know how long the lines are. We never talked about that. Probably you have a unusual encoding where the line ending is not the same as with unix. Do you really have LF (0x0a) for a line ending?

      Is there some weird preallocation which is unrelated to the count of line which blows your memory resources?

      Can't you give us a little complete running example showing us the error message? Otherwise I don't know how to help you any further.

      McA

        Hi

        I tried to run the program and printed the line and got the ouput as below. Its working fine till getting values from C1 line and then when it comes to C2 it is throwing error. I'm assigning some array using substr command in my script.

        $a=0;

        $b=0;

        i.e

        $Var20$a$b = trim(substr($line2,11,15));

        $a++;

        $b++;

        something like that..

        Output:

        A0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx

        A1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX

        A2

        A3

        A4

        A5

        A6

        A7

        A8

        A9

        AA

        C1

        C2XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

        Out of memory!

        I couldnot get what u meant by LF().

        There are some variable assignment in the beginning of the script as well. The file size which Im processing is 5kb only :-(

        Thanks & Regards,

        Sathya V.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025927]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2014-12-17 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (32 votes), past polls