Package: libsvn-perl Version: 1.5.1dfsg1-2 Severity: important SVN::Client leaks so much memory, that it's not usable for any important project. I'm attaching a test case that shows clearly the problem.
Steps to reproduce: Save the attached script as "test" $ svnadmin create /tmp/foo $ svn import -m FOO test file:///tmp/foo/test Adding test Committed revision 1. $ perl test Reusing the SVN object USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20600 0.0 0.6 21380 6592 pts/7 S+ 19:41 0:00 perl test USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20600 42.0 5.2 73560 53528 pts/7 S+ 19:41 0:00 perl test NOT reusing the SVN object USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20600 54.0 0.6 21524 6908 pts/7 S+ 19:41 0:00 perl test foo USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20600 94.0 2.2 41856 22608 pts/7 S+ 19:41 0:01 perl test foo As you can see, while destroying the SVN object on each step alleviates the problem, there's still a very noticeable increment in memory usage, and a serious degradation in performance. If reusing the object, the memory grows unbounded, today we almost killed alioth when running a re-scan of the complete pkg-perl repository with the PET tool. This run was testing the "ls" method. The "cat" method is much worse, and dependent of the size of the object. Using the script source as test: $ perl test Reusing the SVN object USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20871 0.0 0.6 21380 6592 pts/7 S+ 19:48 0:00 perl test USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20871 44.0 7.1 103520 73204 pts/7 S+ 19:48 0:00 perl test NOT reusing the SVN object USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20871 56.0 0.6 21524 6920 pts/7 S+ 19:48 0:00 perl test foo USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20871 95.0 2.0 41960 21448 pts/7 R+ 19:48 0:01 perl test foo Using a 100k file: $ perl test Reusing the SVN object USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20922 0.0 0.6 21380 6596 pts/7 S+ 19:49 0:00 perl test USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20922 68.0 21.3 266044 218972 pts/7 S+ 19:49 0:01 perl test NOT reusing the SVN object USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20922 75.0 0.6 21524 6920 pts/7 S+ 19:49 0:01 perl test foo USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND martin 20922 92.5 7.8 106264 80696 pts/7 S+ 19:49 0:03 perl test foo -- System Information: Debian Release: 5.0 APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.26-1-686-bigmem (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libsvn-perl depends on: ii libapr1 1.2.12-5 The Apache Portable Runtime Librar ii libc6 2.7-18 GNU C Library: Shared libraries ii libsvn1 1.5.1dfsg1-2 Shared libraries used by Subversio ii perl 5.10.0-19 Larry Wall's Practical Extraction ii perl-base [perlapi-5.10.0] 5.10.0-19 minimal Perl system libsvn-perl recommends no packages. libsvn-perl suggests no packages. -- no debconf information
#!/usr/bin/perl -w use SVN::Client; $arg = shift; if($arg) { warn "NOT reusing the SVN object\n"; open FOO, "> /dev/null"; my $ctx = new SVN::Client(); system("ps u $$"); foreach(1..500) { $ctx = new SVN::Client(); #$ctx->ls('file:///tmp/foo', 'HEAD', 0); $ctx->cat (\*FOO, 'file:///tmp/foo/test', 'HEAD'); } system("ps u $$"); } else { warn "Reusing the SVN object\n"; open FOO, "> /dev/null"; system("ps u $$"); my $ctx = new SVN::Client(); foreach(1..500) { #$ctx->ls('file:///tmp/foo', 'HEAD', 0); $ctx->cat (\*FOO, 'file:///tmp/foo/test', 'HEAD'); } system("ps u $$"); exec "perl $0 foo"; }