Skip Menu |

This queue is for tickets about the Digest-MD5-File CPAN distribution.

Report information
The Basics
Id: 30618
Status: resolved
Priority: 0/
Queue: Digest-MD5-File

People
Owner: Nobody in particular
Requestors: pdurbin [...] sesda2.com
Cc:
AdminCc:

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



Subject: file_md5_hex does not memory efficient
Date: Fri, 09 Nov 2007 11:46:14 -0500
To: bug-Digest-MD5-File [...] rt.cpan.org
From: Phil Durbin <pdurbin [...] sesda2.com>
When I calculate the MD5 sum of a large file I get Out of Memory errors where using Digest::MD5::File::file_md5_hex for example , I have a 500GB file : use Digest::MD5::File qw(file_md5_hex); $file_md5=file_md5_hex('OMI-Aura_L1-OML1BRVG_2007m0929t1831-o17060_v921-2007m1106t180547.he4'); print "$file_md5 \n"; Returns : Out of memory! While use Digest::MD5::File; my $n= Digest::MD5->new(); $n->addpath('OMI-Aura_L1-OML1BRVG_2007m0929t1831-o17060_v921-2007m1106t180547.he4'); print $n->hexdigest , "\n"; returns : 4369413dc6a24bba1ea00c545f908c6a which is the desired result . Looking at the code in Digest::MD5::File::file_md5_hex is see the problem is it calculates the MD5 as a single line which of course tries to load it into memory : return Digest::MD5::md5_hex(<$fh>) I would suggest either updating the documentation to warn that it is 'slurping' the file or simply call addpath method and return the hexdigest . -- Phil Durbin ADNET Systems , Inc. 7515 Mission Drive, Suite A1C1 Lanham, MD 20706 301-352-4669 (phone) 301-352-0437 (fax) pdurbin@sesda2.com
Subject: Re: [rt.cpan.org #30618] file_md5_hex does not memory efficient
Date: Mon, 12 Nov 2007 12:34:25 -0600
To: bug-Digest-MD5-File [...] rt.cpan.org
From: Daniel Muey <webmaster [...] simplemood.com>
Thanks Phil, that and another circumstance I saw that could be handled better will be in the next version. Most appreciated! On Nov 9, 2007, at 10:46 AM, Phil Durbin via RT wrote: Show quoted text
> > Fri Nov 09 11:46:35 2007: Request 30618 was acted upon. > Transaction: Ticket created by pdurbin@sesda2.com > Queue: Digest-MD5-File > Subject: file_md5_hex does not memory efficient > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: pdurbin@sesda2.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=30618 > > > > When I calculate the MD5 sum of a large file I get Out of Memory > errors > where using > Digest::MD5::File::file_md5_hex for example , I have a 500GB file : > > use Digest::MD5::File qw(file_md5_hex); > $file_md5=file_md5_hex('OMI-Aura_L1-OML1BRVG_2007m0929t1831- > o17060_v921-2007m1106t180547.he4'); > print "$file_md5 \n"; > Returns : > Out of memory! > > While > > use Digest::MD5::File; > my $n= Digest::MD5->new(); > $n->addpath('OMI-Aura_L1-OML1BRVG_2007m0929t1831- > o17060_v921-2007m1106t180547.he4'); > print $n->hexdigest , "\n"; > > returns : > 4369413dc6a24bba1ea00c545f908c6a > which is the desired result . > > Looking at the code in Digest::MD5::File::file_md5_hex is see the > problem is it calculates the > MD5 as a single line which of course tries to load it into memory : > return Digest::MD5::md5_hex(<$fh>) > > I would suggest either updating the documentation to warn that it is > 'slurping' the file or simply > call addpath method and return the hexdigest . > > -- > Phil Durbin > ADNET Systems , Inc. > 7515 Mission Drive, Suite A1C1 > Lanham, MD 20706 > 301-352-4669 (phone) > 301-352-0437 (fax) > pdurbin@sesda2.com > >
From: DMUEY [...] cpan.org
Should be resolved in 0.06 (just uploaded) let me know how that works for you!
From: DMUEY [...] cpan.org
Should be resolved in 0.06 (just uploaded) let me know how that works for you!
From: DMUEY [...] cpan.org
Should be resolved in 0.06 (just uploaded) let me know how that works for you!