in reply to Re^2: [XS] sv_setpv change in behaviour with perl-5.42.0 and later
in thread [XS] sv_setpv change in behaviour with perl-5.42.0 and later
Except that, with earlier perls, the new buffer is the same length as the old buffer
That's not true. When older Perls create a new buffer, they are just a bit larger than necessary, just like in 5.42.
In all the examples where you claim there's a new buffer was allocated based on the size of the old one, you are mistaken. As I explained, no new buffer was allocated in those cases. set_sv is simply modifying the existing buffer, something you can't do with shared buffer. And since Perl never shrinks a buffer, modifying the buffer does not shrink it.[1]
It can free it, e.g. using undef $s; (as opposed to $s = undef;), which could eventually result with a shorter buffer in $s. But I don't know of any circumstances in which it directly shrinks a buffer.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: [XS] sv_setpv change in behaviour with perl-5.42.0 and later
by syphilis (Archbishop) on Jan 29, 2026 at 06:59 UTC | |
by dave_the_m (Monsignor) on Jan 29, 2026 at 13:23 UTC | |
by syphilis (Archbishop) on Jan 30, 2026 at 05:23 UTC | |
by ikegami (Patriarch) on Jan 30, 2026 at 20:36 UTC | |
by ikegami (Patriarch) on Jan 29, 2026 at 15:45 UTC | |
by Anonymous Monk on Jan 29, 2026 at 22:30 UTC | |
by ikegami (Patriarch) on Jan 30, 2026 at 19:04 UTC |