refcount/is_ref commit

[email protected] (Gopal V) Thu, 28 Dec 2006 15:46:48 +0530
Newsgroups php.apc.dev
Message-ID <[email protected]>
Hi,

Looking at (http://news.php.net/php.pecl.cvs/6820)

-    /* deep-copying ensures that there is only one reference to this in 
memory */
-    (*dst)->refcount = 1;
-    (*dst)->is_ref = 0;
+    (*dst)->refcount = (*src)->refcount;
+    (*dst)->is_ref = (*src)->is_ref;

That could be a problem.

When you copy *from* shm land, the zval->refcount used to be
1 because we never had circular references before. So this *might*
leak (need more time to debug this), but there's another inconsistent
part that might be more important.

Because you call my_copy_zval() before you reset this, the
refcount++ inside that function is over-written with the
src->refcount.

Cheers,
Gopal
PS: every time *I* start working on apc, something like this ruins my
     day too :)
-- 
You can't teach people to be lazy - either they have it, or they don't.