mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_fstring): fstrings should be ELTS_SHARED.
If we resurrect dying objects (non-marked, but not swept yet), pointing shared string can be collected. To avoid such issue, fstrings (recorded to fstring_table) should not be ELTS_SHARED (should not have a shared string). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8c91dfb91b
commit
d7df3e2830
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Nov 28 09:18:39 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* string.c (rb_fstring): fstrings should be ELTS_SHARED.
|
||||
If we resurrect dying objects (non-marked, but not swept yet),
|
||||
pointing shared string can be collected.
|
||||
To avoid such issue, fstrings (recorded to fstring_table)
|
||||
should not be ELTS_SHARED (should not have a shared string).
|
||||
|
||||
Thu Nov 28 01:35:08 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* st.c (st_keys): fix to use st_index_t for size of hash.
|
||||
|
|
9
string.c
9
string.c
|
@ -148,7 +148,14 @@ rb_fstring(VALUE str)
|
|||
rb_gc_resurrect(str);
|
||||
}
|
||||
else {
|
||||
str = rb_str_new_frozen(str);
|
||||
if (STR_SHARED_P(str)) {
|
||||
/* str should not be shared */
|
||||
str = rb_enc_str_new(RSTRING_PTR(str), RSTRING_LEN(str), STR_ENC_GET(str));
|
||||
OBJ_FREEZE(str);
|
||||
}
|
||||
else {
|
||||
str = rb_str_new_frozen(str);
|
||||
}
|
||||
RBASIC(str)->flags |= RSTRING_FSTR;
|
||||
st_insert(frozen_strings, str, str);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue