-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David F. Skoll writes:
> On Thu, 23 Sep 2004, Justin Mason wrote:
> 
> > hmm.  I suspect it may be possible to avoid that though.  it may
> > be the act of taking references to the data somewhere -- simply
> > accessing a hash shouldn't cause a refcount increment.
> 
> It will increment the hash's refcount.  And if you iterate through the
> elements of the hash, you'll increment (then probably soon decrement)
> their reference counts.  I don't think it's avoidable; I've run into
> similar problems before with other reference-counted systems.
> 
> I'm not extremely familiar with SA's code, but I'd guess it has a big
> list of rules somewhere that it iterates through.  That probably touches
> memory all over the place.

argh, yes:

    foreach my $rule (@{$self->{conf}->{biglistofrulenames}) {
      # do something read-only with $rule
    }

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).

- --j.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFBU4XmQTcbUG5Y7woRAs11AKCPUYqlt1MUhCDOcTKeMLK5NCI6cACg2pFr
bN5s4SLCFgEAH3WFNe8d4ZU=
=PBfP
-----END PGP SIGNATURE-----

Reply via email to