The Great Monks -
I'm parsing huge log files of urls looking for specific paramter values. In an attempt to not "reinvent the wheel", I decided to use CGI.pm. But it seemed like memory was leaking like crazy.
Here's a quick example of what I'm talking about:
use CGI;
while (<STDIN>)
{
if (1)
{
my $cgi = new CGI($_);
my $blah = $cgi->param('q')
}
}
You can see that memory is being used about a Mb a sec. if you feed it some random text. Shouldn't the memory be freed (or atleast continued to be used by the process) rather than gargling more? (since it's local to the "if") I even tried "undef".
Also, does anyone have a better solution than using the weighty cgi.pm since all I'm really interest in is just getting the parameter values? I guess I could write some sort of regular expression but there's a lot of room for error.
Thanks in advance-
David
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.