[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: memory-leak - svn::repos instances are not destroyed properly

From: m.voit <m.voit_at_math.uni-goettingen.de>
Date: Mon, 17 Oct 2011 11:23:06 +0200

On 14.10.2011 13:17, Stefan Sperling wrote:
> The perl bindings don't abstract away memory pool handling.
> If you don't pass a pool argument to fs->revision_root(),
> it will use the global pool, which can never be cleared.
>
> You need to use an iteration pool in your script and clear it after
> each iteration of the for-loop.
> See http://subversion.apache.org/docs/community-guide/conventions.html#apr-pools
>
> A good perl code example is this commit to git.git; see the change
> to the while loop at the bottom, which creates a new default subpool
> for functions to use, and clears it after each iteration.
> +my $subpool = SVN::Pool::new_default_sub;
> while ($to_rev < $opt_l) {
> + $subpool->clear;
> $from_rev = $to_rev + 1;
> $to_rev = $from_rev + $repack_after;
> $to_rev = $opt_l if $opt_l < $to_rev;
> print "Fetching from $from_rev to $to_rev ...\n" if $opt_v;
> - my $pool=SVN::Pool->new;
> - $svn->{'svn'}->get_log("/",$from_rev,$to_rev,0,1,1,\&commit_all,$pool);
> - $pool->clear;
> + $svn->{'svn'}->get_log("/",$from_rev,$to_rev,0,1,1,\&commit_all);
> my $pid = fork();
> die "Fork: $!\n" unless defined $pid;
> unless($pid) {

Thank you very much, this was indeed helpful.

kind regards,
Max Voit
Received on 2011-10-17 11:24:21 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.