Skip Menu |
 

This queue is for tickets about the Switch CPAN distribution.

Report information
The Basics
Id: 45232
Status: new
Priority: 0/
Queue: Switch

People
Owner: Nobody in particular
Requestors: skendric [...] fhcrc.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id DA25A4DCF99 for <bug-switch [...] rt.cpan.org>; Wed, 22 Apr 2009 18:25:28 -0400 (EDT)
Received: (qmail 2914 invoked by uid 103); 22 Apr 2009 22:25:28 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 22 Apr 2009 22:25:28 -0000
Received: from MICA.FHCRC.ORG (HELO mica.fhcrc.org) (140.107.152.12) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Wed, 22 Apr 2009 15:25:20 -0700
Received: from jade.fhcrc.org (JADE.FHCRC.ORG [140.107.42.223]) by mica.fhcrc.org (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with ESMTP id n3MMPEFH031296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <bug-switch [...] rt.cpan.org>; Wed, 22 Apr 2009 15:25:14 -0700
Received: from [140.107.232.3] (SHAKTI.FHCRC.ORG [140.107.232.3]) by jade.fhcrc.org (Postfix) with ESMTP id 610CE1AEE0 for <bug-switch [...] rt.cpan.org>; Wed, 22 Apr 2009 15:25:14 -0700 (PDT)
Delivered-To: cpan-bug+switch [...] diesel.bestpractical.com
Subject: memory leak
MIME-Version: 1.0
User-Agent: Thunderbird 2.0.0.21 (Windows/20090302)
X-Spam-Status: No, hits=-0.0 required=8.0 tests=SPF_PASS
Return-Path: <skendric [...] fhcrc.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-switch [...] rt.cpan.org
Date: Wed, 22 Apr 2009 15:25:14 -0700
X-Spam-Level: *
X-PMX-Version: 5.5.3.366731, Antispam-Engine: 2.7.0.366912, Antispam-Data: 2009.4.22.221642
X-FHCRC-Scanned: Wed Apr 22 15:25:15 2009
content-type: text/plain; charset="utf-8"; format="flowed"
Message-ID: <49EF994A.603 [...] fhcrc.org>
To: bug-switch [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Stuart Kendrick <skendric [...] fhcrc.org>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 1561
Download (untitled) / with headers
text/plain 1.5k
Switch.pm-2.14, perl-5.10.0, CentOS 5.3 i think i've found a memory leak in Switch ============================================================ #!/usr/bin/perl use strict; use warnings; use English; use Perl6::Say; use Switch; $OUTPUT_AUTOFLUSH = 1; my ($count, $file, $line); $file = '/var/log/syslog'; open my $fh, '<', $file or die "Cannot open $file: $!"; while ($line = <$fh>) { $count++; switch ($line) { case /Shrill and clear he crowed/ { say 'shrill' } case /recking nothing of wizardry/ { say 'recking' } } print '.' if $count/10000 == int $count/100000; # Entertain me } say "$file contains $count lines"; ============================================================ The resulting process grows steadily in memory usage, until my OS kills it. i can replace the 'switch' statement as follows, and the process stays constant in memory size and terminates normally ============================================================ #!/usr/bin/perl use strict; use warnings; use English; use Perl6::Say; use Switch; $OUTPUT_AUTOFLUSH = 1; my ($count, $file, $line); $file = '/var/log/syslog'; open my $fh, '<', $file or die "Cannot open $file: $!"; while ($line = <$fh>) { $count++; if ($line =~ /frog/) { say 'Shrill and clear he crowed'; } elsif ($line =~ /toad/) { say 'recking nothing of wizardry'; } print '.' if $count/10000 == int $count/100000; # Entertain me } say "$file contains $count lines"; ============================================================ --sk stuart kendrick fhcrc


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.