in reply to What does Test::LeakTrace do?
leaktrace{ require './AlmostEmpty.pm'; } -verbose;
And it shows:
leaked SCALAR(0xa6a8a0) from ./3.pl line 7. 6:leaktrace { 7: require './AlmostEmpty.pm' 8:} -verbose; SV = PV(0xa4ac20) at 0xa6a8a0 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0xebe6e0 "./AlmostEmpty.pm"\0 CUR = 16 LEN = 24
So, the leaked scalar contains the required file name. Why is that? Let's read the documentation:
These SVs include global variables and internal caches. For example, if you call a method in a tracing block, perl might prepare a cache for the method. Thus, to trace true leaks, no_leaks_ok() and leaks_cmp_ok() executes a block more than once.
And indeed, running no_leaks_ok shows:
ok 1 - leaks 0 <= 0
So, it's probably some kind of a global variable. And indeed, compare the output with the one from
use Devel::Peek; Dump $INC{'./AlmostEmpty.pm'};
It shows the same scalar. So, it's just the entry in the %INC hash that prevents Perl from including the file once more if you require it again.
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does Test::LeakTrace do?
by Anonymous Monk on Jan 21, 2018 at 01:45 UTC |