You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Martin Lucina <ma...@imatix.com> on 2005/11/21 00:05:37 UTC
Perl API memory leaks
Hello all,
I've been trying to use the SVN Perl API in a autobuilder script for a
project I'm working on and have found that it leaks memory. For
example, the following simple test case (run it with a repository URL as
the first argument) will allocate more memory each time
get_latest_revnum () is called:
---cut here
#!/usr/bin/perl
use strict;
use warnings;
use SVN::Client;
use SVN::Ra;
my ($auth);
my ($client);
my ($ra);
$auth = [
SVN::Client::get_simple_provider (),
SVN::Client::get_username_provider (),
SVN::Client::get_ssl_server_trust_file_provider ()
];
$client = new SVN::Client (auth => $auth);
$ra = new SVN::Ra (url => $ARGV[0], auth => $auth);
while (1) {
print $ra->get_latest_revnum (), "\n";
}
---cut here
Modifying the script to create $auth, $client and $ra inside the loop
and explicitly destroy them using undef after calling get_latest_revnum
() does not seem to help.
Is there any way around this?
Thanks,
-mato
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Perl API memory leaks
Posted by Martin Lucina <ma...@imatix.com>.
claco@chrislaco.com said:
> Have you tried using pools...SVN::Pool?
I knew that SWIG was just an interface wrapper, but I didn't realise it
was that thin a wrapper! :-)
Is there any way to generate documentation for the Perl API? I find it
somewhat cumbersome to have to refer to the C source code to figure out
how the classes work.
E.g., googling for SVN:Pool leads me to the source code of SVN-Mirror,
but not much else.
-mato
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Perl API memory leaks
Posted by Martin Lucina <ma...@imatix.com>.
claco@chrislaco.com said:
> Have you tried using pools...SVN::Pool?
I just tried the following version:
---cut here
#!/usr/bin/perl
use strict;
use warnings;
use SVN::Client;
use SVN::Ra;
my ($auth);
my ($client);
my ($ra);
my ($pool);
$pool = SVN::Pool->new_default (undef);
$auth = [
SVN::Client::get_simple_provider ($pool),
SVN::Client::get_username_provider ($pool),
SVN::Client::get_ssl_server_trust_file_provider ($pool)
];
$client = new SVN::Client (auth => $auth, pool => $pool);
$ra = new SVN::Ra (url => $ARGV[0], auth => $auth, pool => $pool);
while (1) {
my ($iter_pool) = SVN::Pool->new_default ($pool);
print $ra->get_latest_revnum ($iter_pool), "\n";
}
---cut here
This version doesn't leak if the repository I'm accessing is local
(file:). If I try with my original test with a https: repository then
it leaks much less, but still leaks.
-mato
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Perl API memory leaks
Posted by "Christopher H. Laco" <cl...@chrislaco.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Lucina wrote:
> Hello all,
>
> I've been trying to use the SVN Perl API in a autobuilder script for a
> project I'm working on and have found that it leaks memory. For
> example, the following simple test case (run it with a repository URL as
> the first argument) will allocate more memory each time
> get_latest_revnum () is called:
>
> ---cut here
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use SVN::Client;
> use SVN::Ra;
>
> my ($auth);
> my ($client);
> my ($ra);
>
> $auth = [
> SVN::Client::get_simple_provider (),
> SVN::Client::get_username_provider (),
> SVN::Client::get_ssl_server_trust_file_provider ()
> ];
>
> $client = new SVN::Client (auth => $auth);
>
> $ra = new SVN::Ra (url => $ARGV[0], auth => $auth);
>
> while (1) {
> print $ra->get_latest_revnum (), "\n";
> }
> ---cut here
>
> Modifying the script to create $auth, $client and $ra inside the loop
> and explicitly destroy them using undef after calling get_latest_revnum
> () does not seem to help.
>
> Is there any way around this?
Have you tried using pools...SVN::Pool?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDgRnJ+66dLHM50ssRApNIAKCdkquRlC+VNyp0Icz+9R8UVM2kMgCZAeg5
1j/GwLebca5eMWbllTH6mY4=
=gpx+
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org