|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Re: [XS] sv_setpv change in behaviour with perl-5.42.0 and laterby dave_the_m (Monsignor) |
| on Jan 27, 2026 at 09:06 UTC ( [id://11167244]=note: print w/replies, xml ) | Need Help?? |
|
You're seeing Copy-on-Write (COW) affects. Post 5.40, $buffer's string buffer is being shared with the (constant folded at compiletime) constant SV's buffer which is holding the value of 'z' x 60. When $buffer is assigned to, the COW mechanism leaps into action, and it's given its own string buffer (only as big as it needs to be) to store the changed value.
Dave.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||