File tree 1 file changed +15
-1
lines changed
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.
28
28
29
29
=item *
30
30
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.
32
46
33
47
=item *
34
48
You can’t perform that action at this time.
0 commit comments