Parallel::ForkManager && DBI memory leak ?
From: Ing. Branislav Gerzo (2ge_at_2ge.us)
Date: 12/30/04
- Next message: Thilo Planz: "Re: Parallel::ForkManager && DBI memory leak ?"
- Previous message: Ron Wingfield: "DBI_error( ) Message Handler"
- Next in thread: Thilo Planz: "Re: Parallel::ForkManager && DBI memory leak ?"
- Reply: Thilo Planz: "Re: Parallel::ForkManager && DBI memory leak ?"
- Maybe reply: Ing. Branislav Gerzo: "Re: Parallel::ForkManager && DBI memory leak ?"
- Maybe reply: Robert Follett: "RE: Parallel::ForkManager && DBI memory leak ?"
- Reply: Ron Wingfield: "Re: Parallel::ForkManager && DBI memory leak ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Dec 2004 09:36:07 +0100 To: dbi-users@perl.org
Hi pals,
this is my first post to this mailing list. I have one problem, it is
maybe for you small, but for me a big problem. If I want improve my
scripts I _have_ to use parallel DB access. When I looked around I
come to Parallel::ForkManager module, easy to use.
When I wrote script, I saw it is leaking memory, so I think it is DBI
related problem, you will help me for sure, I hope, here is isolated
problem:
# this is just example script
use strict;
use warnings;
use Parallel::ForkManager;
use DBI;
my @links = (1 .. 1000);
my $pm = new Parallel::ForkManager(5);
foreach my $x (0..$#links) {
$pm->start and next;
my $dbh = DBI->connect("DBI:mysql:database=test;host=localhost;port=3306", "root", "")
or die "Can't connect: ", $DBI::errstr;
$dbh->{RaiseError} = 1;
print "$links[$x]\n";
# do something (read, update, insert from db)
$dbh->do("INSERT INTO TEST (field) VALUES ($x)");
$dbh->disconnect;
$pm->finish;
}
on 100th iteration it uses around 20 MB of memory, on the 200th
iteration it is 30 MB!
I tried to destruct $dbh in many ways (undef for example), but nothing
helps. Could someone give me answer for this ?
And if this is not possible via ForkManager exist some simple script
with forking DBI?
-- --. ,-- ,- ICQ: 7552083 \|||/ `//EB: www.2ge.us ,--' | - |-- IRC: [2ge] (. .) ,\\SN: 2ge!2ge_us `====+==+=+===~ ~=============-o00-(_)-00o-================~ Growing old makes one miss a lot of things, but poor memory helps!OJW
- Next message: Thilo Planz: "Re: Parallel::ForkManager && DBI memory leak ?"
- Previous message: Ron Wingfield: "DBI_error( ) Message Handler"
- Next in thread: Thilo Planz: "Re: Parallel::ForkManager && DBI memory leak ?"
- Reply: Thilo Planz: "Re: Parallel::ForkManager && DBI memory leak ?"
- Maybe reply: Ing. Branislav Gerzo: "Re: Parallel::ForkManager && DBI memory leak ?"
- Maybe reply: Robert Follett: "RE: Parallel::ForkManager && DBI memory leak ?"
- Reply: Ron Wingfield: "Re: Parallel::ForkManager && DBI memory leak ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|