Out of memory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rameshvummadi
    New Member
    • Sep 2008
    • 7

    Out of memory

    Can some body help me why I am getting "out of memory error". Below is the code I am trying to execute. Mu input xml file is 300KB size.
    Code:
    use XML::Simple;
    
    #assigne variables
    my @engines = (1,2,3,4,5);
          
    open(OUTPUT, "> "output_file.txt") or die "Can't open output_file.txt") for write: $!";
    
    # create object
    $xml = new XML::Simple;
    
    # read XML file
    my $data = $xml->XMLin("input.xml",KeyAttr => "number");
    
    
    foreach $n (@engines)
     
    {
     print OUTPUT "***************\n";
     print OUTPUT "Engine $n \n"; 
     print OUTPUT "***************\n";
     print OUTPUT  $data->{Job}->{Step}->{5000}->{Action}->{Engine}->{$n}->{Error};
    }
    
    # print the final totals listing
    
    print OUTPUT "****************\n";
    print OUTPUT "Final Totals    \n";
    print OUTPUT "****************\n";
    print OUTPUT $data->{Job}->{Step}->{5000}->{Action}->{Engine}->{Log};
    print OUTPUT $data->{Job}->{Step}->{7000}->{Action}->{Engine}->{Log};
    print OUTPUT $data->{Job}->{Step}->{9000}->{Action}->{Engine}->{Log};
    
    close OUTPUT;
    Last edited by numberwhun; Oct 2 '08, 12:15 PM. Reason: Please use code tags
  • Icecrack
    Recognized Expert New Member
    • Sep 2008
    • 174

    #2
    first off please use code tags


    Code:
    open(OUTPUT, "> "output_file.txt") or die "Can't open output_file.txt") for write: $!";
    problem could be here


    Code:
    open(OUTPUT, ">", "output_file.txt") or die "Can't open output_file.txt for write: $! ";
    as well we will need some sample input.xml code to help you more
    Last edited by Icecrack; Oct 1 '08, 01:13 PM. Reason: forgot code tags

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      if this line is literally written like this:

      Code:
      open(OUTPUT, "> "output_file.txt") or die "Can't open output_file.txt") for write: $!";
      It will just cause the script to abort with an error so I can't see how that would cause an out of memory error.

      Add this to your code:

      Code:
      use warnings;

      Comment

      • rameshvummadi
        New Member
        • Sep 2008
        • 7

        #4
        Originally posted by KevinADC
        if this line is literally written like this:

        Code:
        open(OUTPUT, "> "output_file.txt") or die "Can't open output_file.txt") for write: $!";
        It will just cause the script to abort with an error so I can't see how that would cause an out of memory error.

        Add this to your code:

        Code:
        use warnings;
        Code:
        open(OUTPUT, "> "output_file.txt")  This line is actually
         open(OUTPUT, "> output_file.txt")
        I typed it wrongly while posting. Sorry.
        Last edited by numberwhun; Oct 2 '08, 12:16 PM. Reason: Please use code tags

        Comment

        • numberwhun
          Recognized Expert Moderator Specialist
          • May 2007
          • 3467

          #5
          Ok, Icecrack was kind enough to ask you to please use code tags, I have fixed your first post and now, your latest post STILL has no code tags.

          The code tags are NOT an option and are required. You need to please read the Posting Guidelines for this site.

          This is your only warning after having been asked to use them.

          Regards,

          Jeff (Moderator)

          Comment

          • Icecrack
            Recognized Expert New Member
            • Sep 2008
            • 174

            #6
            Originally posted by rameshvummadi
            Code:
            open(OUTPUT, "> "output_file.txt")  This line is actually
             open(OUTPUT, "> output_file.txt")
            I typed it wrongly while posting. Sorry.
            as posted above we will need some sample of your xml file or the whole.
            this way we can test it, and see if its your site or its the scirpt.


            Thank you.

            Comment

            Working...