On Thu, 23 Sep 2004, Justin Mason wrote:

> you're right, that *will* incr the refcount on every entry in
> that array, touching the page and triggering copy-on-write.

> we need to think how to fix this (or if it needs to be fixed;
> if fixing it will be slower, it may not be useful to do so).

I don't believe it is fixable if you want to stick with Perl. :-(

The only way to fix it would be with some ugliness like Devel::WeakRef
or something similar, which is rather dangerous.  It's also very hard to
make absolutely sure you never accidentally create a strong reference.

Another option, probably also unpalatable, is to have custom C code
that stores the rules and returns copies of them when asked.  The
copies will have their reference counts updated, but since they should
be short-lived and ephemeral, it shouldn't touch too many data pages.

Regards,

David.

Reply via email to