[rt-devel] debug info on memory leaks under mod_perl.

Jesse Vincent jesse at bestpractical.com
Tue Oct 21 23:06:51 EDT 2003



On Tue, Oct 21, 2003 at 12:46:08PM +0400, Ruslan U. Zakirov wrote:
> Yep. This do Right thing, this is first what I do when was testing 
> 'weaken' solution. But if we add one string?
> >sh-2.05a# more memtest
> >#!/usr/bin/perl
> >
> >use lib qw(/opt/rt3/lib);
> >use RT;
> >RT::LoadConfig();
> >RT::Init();
> >
> >use RT::CurrentUser;
> >sub RT::CurrentUser::DESTROY {
> >    print "HULK SMASH!\n";
> >}
> >for (my $i = 1; $i <= 500; $i++) {
> >    print "Loading user $user...";
> >    my $user = RT::CurrentUser->new('root');
>       my $UserObj = $user->UserObj;

We have a new fix that fixes thsi.

> >
> Same with principal object. And bad thing is that we could not isolate 
> using of 'weaken' in CurrentUser class. If we do $self->{'UserObj'} 
> weaken then when RT lost somewhere pointer on it $self->{'UserObj'} it 
> would be undefined and calling it cause another select to DB. :(

So. That caching of $self->{'UserObj'} isn't actually important anymore,
since we've got SB::Record::Cachable that wil lsave us from doing the
select, assuming a non-pathalogical case. So it no loger builds a
longlived object fo that one, just a throwaway.

  
I can't actually find your PrincipalObj issue with my new code:


#!/usr/bin/perl
 
use lib qw(/opt/rt3/lib);
use RT;
RT::LoadConfig();
RT::Init();

use RT::CurrentUser; 
sub RT::Record::DESTROY { 
my $self = shift;
print "HULK SMASH $self!\n"; 
}
for (my $i = 1; $i <= 5; $i++) { 
print "Loading user $user..."; 
my $user = RT::CurrentUser->new('root'); 
my $UserObj = $user->UserObj; 
my $pobj = $UserObj->PrincipalObj;
my $puo = $pobj->Object;
print "User: $UserObj - CurrentUser - $user - pobj - $pobj  - $puo\n";



}
 
print "Done";





> _______________________________________________
> rt-devel mailing list
> rt-devel at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-devel
> 

-- 
http://www.bestpractical.com/rt  -- Trouble Ticketing. Free.



More information about the Rt-devel mailing list