[p4perl] Leak in p4perl Tagged/annotate

Tony Smith tony at smee.org
Mon Sep 19 10:56:16 PDT 2005


Hi Mats,

> I experience a rather severe memory leak (on the client) while doing
> the following. It seems to be dependent on the $p4->Tagged line. This
> simple loop consumes all of my virtual memory.
> 
> use P4; $p4 = new P4; $p4->Tagged; $p4->Init; $files =
> "//depot/some/where/....c*"; for (1..100) { $res =
> $p4->Run("annotate", "-cq", $files); undef $res; # doesn't have any
> effect } $p4->Final; undef $p4;
> 
> Can someone else confirm this behaviour?
> 
> I'm using Activestate Perl 5.8.0 (build 802) on a Windows 2000 Pro
> with p4perl version p4perl58-setup-3.4804.exe against a 2005.1
> perforce server on a Windows 2003 Server.

I suspect the latest development build will solve this problem. Here's
the relevant entry from the change log:

3.5038  Mon Jul 04 2005

	- Bug fix: Fix memory leaks in P4Perl reported by Craig Galley.
	  Perl's reference count garbage collection is not much fun to
	  work with, but hopefully this change plugs P4Perl's leaks.
	  There's still a leak that remains, but whether it's in
	  P4Perl's code or just in Perl I don't know. A loop like this:
	
	    while( 1 ) {
		my $p4 = new P4;
	    }
	
	  will leak like a sieve but I'm pretty sure P4Perl is cleaning
	  up as it should. While it's very difficult to be certain with
	  Perl's memory mode, creating one P4 object and using it
	  multiple times now appears to be pretty steady.
	
	- Also fixed use of uninitialized debug variable which could
	  produce debug output you hadn't asked for.

So any build later than 3.5038 should help a lot.

Tony


More information about the p4perl mailing list