File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,21 @@ directly>. These cases are now fully supported.
2828
2929=item *
3030
31- Various optimizations related to handling of C<CONST>s.
31+ Constant-folded strings are now sharable via the Copy-on-Write mechanism.
32+ [L<GH #22163|https://github.com/Perl/perl5/pull/22163>]
33+
34+ The following code would previously have allocated eleven string buffers,
35+ each containing one million "A"s:
36+
37+ C<my @scalars; push @scalars, ("A" x 1_000_000) for 0..9;>
38+
39+ Now a single buffer is allocated and shared between a CONST OP and
40+ the ten scalar elements of L<@scalars>.
41+
42+ Note that any code using this sort of constant to simulate memory leaks
43+ (perhaps in test files) must now permute the string in order to trigger
44+ a string copy and the allocation of separate buffers. For example,
45+ C<("A" x 1_000_000).localtime> might be a suitable small change.
3246
3347=item *
3448
You can’t perform that action at this time.
0 commit comments