mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
04bc4c0662
When a string is #frozen, it's capacity is resized to fit (if it is much larger), since we know it will no longer be mutated. > puts ObjectSpace.dump(String.new("a"*30, capacity: 1000)) {"type":"STRING", "class":"0x7feaf00b7bf0", "bytesize":30, "capacity":1000, "value":"... > puts ObjectSpace.dump(String.new("a"*30, capacity: 1000).freeze) {"type":"STRING", "class":"0x7feaf00b7bf0", "frozen":true, "bytesize":30, "value":"... (ObjectSpace.dump doesn't show capacity if capacity is equal to bytesize) Previously, if we dedup into an fstring, using String#-@, capacity would not be reduced. > puts ObjectSpace.dump(-String.new("a"*30, capacity: 1000)) {"type":"STRING", "class":"0x7feaf00b7bf0", "frozen":true, "fstring":true, "bytesize":30, "capacity":1000, "value":"... This commit makes rb_fstring call rb_str_resize, the same as rb_str_freeze does. Closes: https://github.com/ruby/ruby/pull/2256 |
||
---|---|---|
.. | ||
arith_seq | ||
array | ||
bignum | ||
bug_reporter | ||
class | ||
debug | ||
exception | ||
file | ||
float | ||
funcall | ||
gvl | ||
hash | ||
integer | ||
iseq_load | ||
iter | ||
load | ||
marshal | ||
method | ||
num2int | ||
path_to_class | ||
popen_deadlock | ||
postponed_job | ||
proc | ||
rational | ||
st | ||
string | ||
struct | ||
symbol | ||
thread_fd_close | ||
time | ||
tracepoint | ||
typeddata | ||
vm | ||
wait_for_single_fd | ||
win32 | ||
test_bug-3571.rb | ||
test_bug-5832.rb | ||
test_notimplement.rb | ||
test_printf.rb | ||
test_recursion.rb | ||
test_scan_args.rb |