[Bins] Bug#395098: bins: Bins is very slow,
eats memory and makes unnecessary system calls
Martin Michlmayr
tbm at cyrius.com
Tue Oct 24 23:36:19 BST 2006
From: Hans-Joachim Baader <hjb at pro-linux.de>
Subject: Bug#395098: bins: Bins is very slow, eats memory and makes
unnecessary system calls
Date: Tue, 24 Oct 2006 22:59:50 +0200
Package: bins
Version: 1.1.29-6
Severity: normal
Tags: patch
On my system bins was not able to complete album creation without a
patch. The patch (attached) removes some unnecessary system() calls
and replaces them by Perl functions.
However, bins still eats memory and therefore becomes very slow.
Here's a line from top:
24812 hans 25 0 998m 553m 72m R 76.7 54.6 92:11.21 bins
That's with only a few 1000 photos (4.4 GB). I don't know where the
memory leaks but perhaps a few undefs in the right places would fix
it.
Patch:
--- /usr/bin/bins 2006-01-27 14:27:09.000000000 +0100
+++ bins 2006-10-24 22:49:31.000000000 +0200
@@ -1872,7 +1872,7 @@
$newpath = $from;
}
beVerboseN("Linking from $to to $newpath...", 2);
- system("ln", "-sf", $newpath, $to) == 0
+ symlink($newpath, $to) == 1
or die("\nCannot link $to to $newpath: $?");
} else {
beVerboseN("Copying from $from to $to...", 2);
@@ -3468,13 +3468,14 @@
$newpath = "$picdir$origName";
}
beVerboseN("Linking from $albumdir$newName to $newpath... ", 2);
- system("ln", "-sf", $newpath, "$albumdir$newName") == 0
+ unlink("$albumdir$newName");
+ symlink($newpath, "$albumdir$newName") == 1
or die("\nCannot link $albumdir$newName to $newpath: $?");
# the original file may be r/o but we don't have to modify it
# but it must be readable by the http deamon
if ($configHash->{updateOriginalPerms})
{
- system("chmod", "a+r", "$picdir$origName") == 0
+ chmod(0644, "$picdir$origName") == 1
or die("\nCannot set read permission on $albumdir$newName: $?");
}
beVerboseN("done.", 2);
@@ -3485,7 +3486,7 @@
system("cp", "-p", "$picdir$origName", "$albumdir$newName") == 0
or die("\nCannot copy $picdir$origName to $albumdir$newName: $?");
# make it writable in case $origName was r/o
- system("chmod", "u+w,a+r", "$albumdir$newName") == 0
+ chmod(0644, "$albumdir$newName") == 1
or die("\nCannot set write permission on $albumdir$newName: $?");
beVerboseN("done.", 2);
return 1;
----- End forwarded message -----
--
Martin Michlmayr
http://www.cyrius.com/
More information about the Bins
mailing list