Luke Palmer <[EMAIL PROTECTED]> wrote:
> This fixes a rather obvious and silly oversight in my patch.

> +    PObj_COW_CLEAR((PObj*)buf);

I don't think that works or better let's say: it's ok 50 percent - for
the new "buf" chunk, but the old one, which maybe hasn't any refering
COWed copy anymore still has the COW flag on that buffer.

Comments towards my COW comments are more then welcome.

The refount ideas is like this:

1) Prelims
- the refcount is living somewhere after the shared PObj's bufstart
- COWed copys get a new Buffer header (like strings do)

(Both are given for strings, refcounts are already used for DOD/GC)

2) Functionality
- a freshly COWed PObj has a refcount of 2 (we have two PObjs now)
- another COW copy increases the refcount by 1
- operations like copy_chunk(or unmake_COW) are only needed if the
  refcount is >= 2
- operations like unmake_COW clear the COW flag of the destination -
  that is the above patch - *and* decrease the refcount
- DOD on POBj with refcount <= 1 works like normal, i.e. the COW flag,
  if any, can be cleared
- DOD with PObj with refcount >= 2 is like now, we have to recalulcate
  the refcount (object might be dead in the meantime).

leo

Reply via email to