Hi Here is my code but seems to consume all 4GB of my system memory. Please help
top - 14:19:45 up 3 days, 12:33, 1 user, load average: 4.20, 4.27, 5 +.08 Tasks: 97 total, 1 running, 96 sleeping, 0 stopped, 0 zombie Cpu(s): 12.0% us, 21.2% sy, 0.0% ni, 65.9% id, 0.1% wa, 0.0% hi, 0 +.8% si Mem: 3765572k total, 3663796k used, 101776k free, 42856k buffe +rs Swap: 2031608k total, 368k used, 2031240k free, 3141516k cache +d
______
#!/usr/bin/perl -w use strict; use DBI(); my $cdr_log_file = "/var/log/asterisk/my_log"; my $mysql_host = "localhost"; my $mysql_db = "user"; my $mysql_table = "tbl_data"; my $mysql_user = "user"; my $mysql_pwd = "xxx*"; #my @ARGV; my $insert_str; my $sth; my $cdate=$ARGV[0]; my $clang=$ARGV[1]; my $csrc=$ARGV[2]; my $ccode=$ARGV[3]; my $cuniqueid=$ARGV[4]; # Connect to database # print "Connecting to database...\n\n"; my $dbh = DBI->connect("DBI:mysql:database=$mysql_db;host=$mysql_host" +,"$mysql_user","$mysql_pwd",{'RaiseError' => 1}); $insert_str = "insert into $mysql_table (data1, data2, data3, data4, d +ata5) values (\"$cdate\", \"$clang\", \"$csrc\", \"$ccode\", \"$cuni +queid\");\n"; $sth = $dbh->prepare($insert_str); $sth->execute(); # print "."; $sth->finish(); $dbh->disconnect(); exit;

In reply to Memory Leak: Uses 3GB+ by kilimanjaro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.