develooper Front page | perl.perl5.porters | Postings from January 2003

Re: Freeing code

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
January 27, 2003 17:01
Subject:
Re: Freeing code
Message ID:
20030128005803.B4023@fdgroup.com
On Mon, Jan 27, 2003 at 10:38:40PM +0000, Dave Mitchell wrote:
> I see a similar very slow leak on the one-liner
> 
>     eval '' while 1;
> 
> Which increases in size by a page (4K) every 10-20 secs

P5Pers - I've confirmed that this is a real leak!

It turns out that one in every 64K ops will not be freed, due to the
following:

    Perl_op_free(pTHX_ OP *o)
    {
	register OP *kid, *nextkid;
	OPCODE type;

	if (!o || o->op_seq == (U16)-1)
	    return;


The "o->op_seq == (U16)-1" condition was added somewhere between 5.003_22
and 5.004_05, and I have no idea what it's for.

op_seq seems to get set from PL_op_seqmax, which only seems to get
incremented in Perl_peep, and which of course soon wraps round in the
presence of evals in a loop.

Removing the -1 condition doesn't cause any obvious test failures.

Ideas, anyone?

Dave.

-- 
print+qq&$}$"$/$s$,$*${$}$g$s$@$.$q$,$:$.$q$^$,$@$*$~$;$.$q$m&if+map{m,^\d{0\,},,${$::{$'}}=chr($"+=$&||1)}q&10m22,42}6:17*2~2.3@3;^2$g3q/s"&=~m*\d\*.*g

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