Running out of memory?

Running out of memory?

am 19.07.2007 14:56:36 von mpetersen

I am new to perl, so this may be a dumb question.

I have written a perl program that reads firms 10Ks (their financial
disclosure) looking for their total assets. Some of the files are in html,
so I use HTML::TreeBuilder and HTML::TableContentParser. Some of the files
are in text, so I use a regular expression to find the row that says "total
assets" and then scans across to find the number. I have copied the files
to my hard disk to speed up the process. The program searchs through each
file sequentially, then writes out a line of output for each file. The
program crashes when the outfile reaches 32,768 bytes. I have changed the
file files I feed the program in case this is a problem, and it still
crashes at 32,768 bytes.

I am running the perl program through a dos window (cmd.exe window) under
Windows Vista. If there is a smarter way to do this, I'd love to hear. The
output file does not contain any data until the program crashes. I included
the command
$|++ which I thought would cause the print buffer to flush to the output
file -- but this doesn't seem to be working

If there is other info that I should add, please let me know. Thanks.

Mitchell


_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Running out of memory?

am 19.07.2007 15:32:50 von Bill Luebkert

Mitchell A. Petersen wrote:
> I am new to perl, so this may be a dumb question.
>
> I have written a perl program that reads firms 10Ks (their financial
> disclosure) looking for their total assets. Some of the files are in html,
> so I use HTML::TreeBuilder and HTML::TableContentParser. Some of the files
> are in text, so I use a regular expression to find the row that says "total
> assets" and then scans across to find the number. I have copied the files
> to my hard disk to speed up the process. The program searchs through each
> file sequentially, then writes out a line of output for each file. The
> program crashes when the outfile reaches 32,768 bytes. I have changed the
> file files I feed the program in case this is a problem, and it still
> crashes at 32,768 bytes.
>
> I am running the perl program through a dos window (cmd.exe window) under
> Windows Vista. If there is a smarter way to do this, I'd love to hear. The
> output file does not contain any data until the program crashes. I included
> the command
> $|++ which I thought would cause the print buffer to flush to the output
> file -- but this doesn't seem to be working
>
> If there is other info that I should add, please let me know. Thanks.

First, if you aren't putting a newline out every line - add that.
Make sure you're closing each input file after scanning it.

If that doesn't help, create a complete program snippet that fails as
you describe (you may not need to read the files if you can reproduce
it without parsing the files - just write the output as you currently
are using some static data and see if that fails for you). Assuming
you can reproduce the error, post that snippet.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs