Re: [APC-DEV] refcount/is_ref commit

[email protected] (Gopal V) Fri, 29 Dec 2006 15:13:50 +0530
Newsgroups php.apc.dev
Message-ID <[email protected]>
Brian Shire wrote:

>> +    (*dst)->refcount = (*src)->refcount;
>> +    (*dst)->is_ref = (*src)->is_ref;
...
> I don't believe we should have an APC shared memory leak, but that's 
> something I should verify. 

<?php
$a = array("hello !");
$b = &$a;
$c = &$a;

debug_zval_dump($c[0]);

apc_store('foozbar', $c[0]);
?>

Not quite sure it leaks, but it still gives an invalid refcount into
shm land. The original refcount reset came from a bit of similar code.

> Wonder if the preferred solution is something more along the lines of 
> (saying this without testing it out *too* much):
...
> +    } else {
> +        (*dst)->refcount = 1;
>      }

Yes, that might work. But I still feel the need to simplify all this
code, trying to avoid the hash lookup in the copy *out* of cache and
probably revert a bit of code (especially the semantics of free_ vs
destroy_).

> "If I learn from my mistakes, pretty soon I'll know everything."  :-)

:D

Cheers,
Gopal
--