Tim Bunce wrote:
> On Thu, May 02, 2002 at 07:03:06PM +0800, Stas Bekman wrote:
> 
>>>>Is it possible to simply localize the hash elements? Will this work 
>>>>properly?
>>>>
>>>> {
>>>>      my $dbh = DBI->connect(@connect) || die $DBI::errstr;
>>>>
>>>>      print "LongReadLen is: ", $dbh->{LongReadLen}, "\n";
>>>>      local $dbh->{LongReadLen} = 40;
>>>>      print "LongReadLen is now: ", $dbh->{LongReadLen}, "\n";
>>>>  }
>>>>
>>>>  my $dbh = DBI->connect(@connect) || die $DBI::errstr;
>>>>
>>>>  print "LongReadLen for new dbh is: ", $dbh->{LongReadLen}, "\n";
>>>>
>>>>If localization works, that's probably the best solution, that can be 
>>>>applied by users.
>>>
>>>Yes, that'll work. But in some versions of perl it leaks memory
>>>(including 5.005 and 5.006, not sure about 5.5.3 and 5.6.1 or later).
>>
>>Is it a perl tie mechanism's problem or DBI's?
> 
> 
> Perl's.
> 
> 
>>what about 5.8.0-tobe? Do you know of a version that doesn't leak?
> 
> 
> Not off-hand. Hopefully the latest doesn't. CC'd to perl5-porters
> as I'm sure someone there will know (or ought to :)
> 
> 
>>I've tested with Apache::Leak, the above block { } is reported to leak:
> 
> 
> You don't say which version of perl.

well you said that it leaks :) so I just tried with 5.6.1

>>ENTER: 35222 SVs
>>new 0x8606a34 : SV = PVMG(0x8606480) at 0x8606a34
>>   REFCNT = 1
>>   FLAGS = (GMG,SMG,RMG,pIOK,pNOK)
>>   IV = 40
>>   NV = 40
>>   PV = 0
>>   MAGIC = 0x8606fc8
>>     MG_VIRTUAL = &PL_vtbl_packelem
>>     MG_TYPE = 'p'
>>     MG_FLAGS = 0x02
>>       REFCOUNTED
>>     MG_OBJ = 0x857361c
>>         SV = RV(0x8115920) at 0x857361c
>>           REFCNT = 152
>>           FLAGS = (ROK)
>>           RV = 0x8573574
>>     MG_LEN = -2
>>     MG_PTR = 0x86069e0 => HEf_SVKEY
>>         SV = PV(0x8604ef8) at 0x86069e0
>>           REFCNT = 1
>>           FLAGS = (POK,pPOK)
>>           PV = 0x8606fb8 "LongReadLen"\0
>>           CUR = 11
>>           LEN = 12
>>new 0x8606a40 : SV = NULL(0x0) at 0x8606a40
>>   REFCNT = 1
>>   FLAGS = (PADBUSY,PADMY)
>>
>>LEAVE: 35224 SVs
>>!!! 2 SVs leaked !!!


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to