[#62297] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap. — Eric Wong <normalperson@...>
nari@ruby-lang.org wrote:
7 messages
2014/05/02
[#62307] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— SASADA Koichi <ko1@...>
2014/05/03
(2014/05/03 4:41), Eric Wong wrote:
[#62402] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— Eric Wong <normalperson@...>
2014/05/05
SASADA Koichi <ko1@atdot.net> wrote:
[#62523] [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan — ko1@...
Issue #9632 has been updated by Koichi Sasada.
3 messages
2014/05/11
[#62556] doxygen (Re: Re: [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan) — Tanaka Akira <akr@...>
2014-05-11 8:50 GMT+09:00 Eric Wong <normalperson@yhbt.net>:
3 messages
2014/05/13
[#62727] [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl — Eric Wong <normalperson@...>
rb_unlink_method_entry may cause old_me to be swept before the new
7 messages
2014/05/24
[#63039] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/10
Hi,
[#63077] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/10
SASADA Koichi <ko1@atdot.net> wrote:
[#63086] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/11
(2014/06/11 4:47), Eric Wong wrote:
[#63087] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/11
SASADA Koichi <ko1@atdot.net> wrote:
[#62862] [RFC] README.EXT: document rb_gc_register_mark_object — Eric Wong <normalperson@...>
Any comment on officially supporting this as part of the C API?
5 messages
2014/05/30
[ruby-core:62646] [ruby-trunk - Bug #9847] [Closed] Cannot create new String when using File.read(size, buffer)
From:
nobu@...
Date:
2014-05-17 23:22:38 UTC
List:
ruby-core #62646
Issue #9847 has been updated by Nobuyoshi Nakada. Status changed from Open to Closed % Done changed from 0 to 100 Applied in changeset r45979. ---------- io.c: buffer must be modifiable * io.c (io_setstrbuf): always check if the buffer is modifiable. [ruby-core:62643] [Bug #9847] ---------------------------------------- Bug #9847: Cannot create new String when using File.read(size, buffer) https://bugs.ruby-lang.org/issues/9847#change-46781 * Author: Kenneth Guerin * Status: Closed * Priority: Normal * Assignee: * Category: core * Target version: current: 2.2.0 * ruby -v: 2.1.2p95 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- This bug was first noticed in version 1.9.2 and is still present in 2.1.2p95 The attached script does the following to highlight this bug: - create a file of 13 fixed-length records of a specific size: all records contain a repeated letter, A for the first, B for the second, through M - Test #1: read all records from the file and store them into an array of Strings, using File.read(size) and storing via 'cache << buffer' - Test #2: read all records from the file and store them into an Array of Strings, using File.read(size, buffer) and storing via 'cache << String.new(buffer)'; buffer will be reused during each read, cache will hold copies - test cycle is run using a record length of 23 and a record length of 24, highlighting Ruby's optimization of short strings Results of running this script: - with a record size of 23, Tests #1 & #2 show the cache containing all records: [ A, B, ... M ] - with a record size of 24, Test #1 shows the cache containing all records: [ A, B, ... M ] - with a record size of 24, Test #2 shows the cache containing: [ M, M, ... M ] Diagnosis & Notes: - with a record size > 23 and reading a file using File.read(size, buffer), buffer is in such a state as to prevent a new unique String from being derived - variations of this script showed that String.new was a creating new String object on each record read, but the contents of all of the Strings stored in the cache Array were being overwritten on each call to File.read - this shows that String.new(buffer) is creating new String objects, but that the underlying values of all strings based on buffer were sharing the same internal memory - this behavior exists in the "long string" variation of String; short optimized Strings do not share this property ---Files-------------------------------- strbug.rb (2.07 KB) -- https://bugs.ruby-lang.org/