Skip to content
Snippets Groups Projects
Commit 9f287e73 authored by Andy Yates's avatar Andy Yates
Browse files

Avoid slurp as proc is special and has no size

parent a644e412
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ use warnings;
use base qw/Bio::EnsEMBL::Hive::Process/;
use Bio::EnsEMBL::Utils::Exception qw/throw/;
use Bio::EnsEMBL::Utils::IO qw/slurp/;
use Bio::EnsEMBL::Utils::IO qw/work_with_file/;
use Bio::EnsEMBL::Utils::Scalar qw/check_ref/;
use File::Find;
use File::Spec;
......@@ -189,7 +189,13 @@ sub _memory_consumption {
my ($self) = @_;
my $file = "/proc/$$/statm";
if(-f $file) {
my ($memory) = split / /, slurp($file);
my $memory;
work_with_file($file ,'r', sub {
my ($fh) = @_;
local $/ = undef;
my $content = <$fh>;
($memory) = split / /, $content;
});
return sprintf('%dMB', ($memory / 1024 / 1024));
}
return q{?MB};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment