Confirmed repeatable:
$ prove -vb object-pad-leak.t
object-pad-leak.t ..
not ok 1
# Failed test at object-pad-leak.t line 15.
# Lost 540672 bytes of memory over 10000 calls, average of 54.07 per call
# Writing heap dump to object-pad-leak-1.pmat
# Writing heap dump after one more iteration to object-pad-leak-1-after.pmat
1..1
# Looks like you failed 1 test of 1.
...
leo@shy:~/src/perl/Object-Pad [bzr]
$ pmat-diff object-pad-leak-1{,-after}.pmat
A B
ARRAY(0) at 0x55d8202745e8
HASH(0) at 0x55d820274690
UNDEF() at 0x55d8202748e8
HASH(0) at 0x55d820274948
UNDEF() at 0x55d820274960
---
2 unique to A
3 unique to B
33679 common
On Mon Apr 13 13:11:39 2020, TEAM wrote:
Show quoted text> Some observations so far:
>
> - Devel::MAT shows a long list of empty AVs from the test case
> - each of these has refcnt 1, but no inrefs nor outrefs
> - at a guess, this *could* be the meta->slots AV...
> - ... and it's not immediately clear what part of the code would free
> this? There's a newAV but no obvious mechanism for reducing the refcnt
> on destruction or av_undef()-ing it out of existence?
It does indeed:
$ pmat object-pad-leak-1-after.pmat
Perl memory dumpfile from perl 5.30.0 threaded
Heap contains 33682 objects
Show quoted textpmat> show 0x55d8202745e8
ARRAY(0) at 0x55d8202745e8 with refcount 1
size 64 bytes
0 elements (use 'elems' command to show)
Show quoted textpmat> identify 0x55d8202745e8
ARRAY(0) at 0x55d8202745e8 is:
└─the lexical @(Object::Pad/slots) at depth 1 of CODE(PP) at 0x55d820112290, which is:
└─the symbol '&Example::BUILD'
A new empty array. Note this isn't the backing array of any instance of the class. Also it has zero elements in it, whereas an instance would have an element.
I wonder if this is a new empty array created by the saved "clear pad index" operation. Possibly a different mechanism is required here; as the array is just an alias.
--
Paul Evans