PERL_COPY_ON_WRITE has nothing to do with threads or process as far as I can see.
It is used by code within the pp_hot.c, regcomp.h and other places to avoid copying data until (and unless) it is written to.
An example with informative comment comes from pp_hot.c:
#ifdef PERL_COPY_ON_WRITE
/* The match may make the string COW. If so, brilliant, because that's
just saved us one malloc, copy and free - the regexp has donated
the old buffer, and we malloc an entirely new one, rather than the
regexp malloc()ing a buffer and copying our original, only for
us to throw it away here during the substitution. */
if (SvIsCOW(TARG)) {
sv_force_normal_flags(TARG, SV_COW_DROP_PV);
} else
#endif
Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
|