develooper Front page | perl.perl5.porters | Postings from October 2021

Re: leak testing modules [was: [Encode] 3.15 Released]

Thread Previous | Thread Next
From:
Eric Wong
Date:
October 12, 2021 00:42
Subject:
Re: leak testing modules [was: [Encode] 3.15 Released]
Message ID:
20211012004216.GA23089@dcvr
"Paul \"LeoNerd\" Evans" <leonerd@leonerd.org.uk> wrote:
> On Mon, 11 Oct 2021 20:43:09 +0000
> Eric Wong <p5p@yhbt.net> wrote:
> 
> > Does anybody here have suggestions on how to go about adding
> > leak tests to packages like Encode?
> 
> I usually use Test::Refcount.

Thanks for the response, but can that check for allocations made
(and lost) from inside XS?

The leaks which got fixed in Encode was created by newSV() and
the SV not being mortalized; so it got lost on croak and AFAIK
that can't be tested by pure Perl.  Something like valgrind
could notice that leak, as would (AFAIK) PL_sv_count.

Adding valgrind to a test suite seems heavy-handed; so I wonder
if XS::APITests::sv_count should be moved to Devel::Peek or
similar.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About