in reply to What is PERL_COPY_ON_WRITE Compile Option About
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What is PERL_COPY_ON_WRITE Compile Option About
by DeadPoet (Scribe) on Mar 04, 2005 at 18:31 UTC | |
by BrowserUk (Patriarch) on Mar 04, 2005 at 18:41 UTC | |
by nobull (Friar) on Mar 05, 2005 at 18:56 UTC |