-----Original Message----- From: Niels Larsen

Chris: not sure, but searching with svTHINKFIRST gives nothing,
and I saw nothing by glancing over the perlguts page.

There is some brief mention of COW in perlguts:

[quote]
Copy on Write
 Perl implements a copy-on-write (COW) mechanism for scalars, in which
 string copies are not immediately made when requested, but are deferred
 until made necessary by one or the other scalar changing. This is mostly
 transparent, but one must take care not to modify string buffers that
 are shared by multiple SVs.

 You can test whether an SV is using copy-on-write with "SvIsCOW(sv)".

 You can force an SV to make its own copy of its string buffer by calling
 "sv_force_normal(sv)" or SvPV_force_nolen(sv).

 If you want to make the SV drop its string buffer, use
 "sv_force_normal_flags(sv, SV_COW_DROP_PV)" or simply "sv_setsv(sv,
 NULL)".

 All of these functions will croak on read-only scalars (see the previous
 section for more on those).

 To test that your code is behaving correctly and not modifying COW
 buffers, on systems that support mmap(2) (i.e., Unix) you can configure
 perl with "-Accflags=-DPERL_DEBUG_READONLY_COW" and it will turn buffer
 violations into crashes. You will find it to be marvellously slow, so
 you may want to skip perl's own tests.
[end quote]

But no mention of svTHINKFIRST which, iirc, was supposedly of some help. Couldn't find much in perlapi, either. To date, I've had no use for COW, and have taken little interest in it, beyond doing whatever it takes to work around it.

Cheers,
Rob

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to