<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/encoding.c, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[Bug #20598] Fix corruption of internal encoding string (#11069)</title>
<updated>2024-06-28T20:04:49+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-06-28T20:04:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=291cc913503475a204c93a53a2f470c8cc6bfca2'/>
<id>291cc913503475a204c93a53a2f470c8cc6bfca2</id>
<content type='text'>
Fix corruption of internal encoding string

[Bug #20598]

Just like [Bug #20595], Encoding#name_list and Encoding#aliases can have
their strings corrupted when Encoding.default_internal is set to nil.

Co-authored-by: Matthew Valentine-House &lt;matt@eightbitraptor.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix corruption of internal encoding string

[Bug #20598]

Just like [Bug #20595], Encoding#name_list and Encoding#aliases can have
their strings corrupted when Encoding.default_internal is set to nil.

Co-authored-by: Matthew Valentine-House &lt;matt@eightbitraptor.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #20595] Fix corruption of encoding name string (#11063)</title>
<updated>2024-06-27T14:46:53+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-06-27T14:46:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7a780a3ef766e0622ade4a5fbf2518f73c38282b'/>
<id>7a780a3ef766e0622ade4a5fbf2518f73c38282b</id>
<content type='text'>
Fix corruption of encoding name string

[Bug #20595]

enc_set_default_encoding will free the C string if the encoding is nil,
but the C string can be used by the encoding name string. This will cause
the encoding name string to be corrupted.

Consider the following code:

    Encoding.default_internal = Encoding::ASCII_8BIT
    names = Encoding.default_internal.names
    p names
    Encoding.default_internal = nil
    p names

It outputs:

    ["ASCII-8BIT", "BINARY", "internal"]
    ["ASCII-8BIT", "BINARY", "\x00\x00\x00\x00\x00\x00\x00\x00"]

Co-authored-by: Matthew Valentine-House &lt;matt@eightbitraptor.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix corruption of encoding name string

[Bug #20595]

enc_set_default_encoding will free the C string if the encoding is nil,
but the C string can be used by the encoding name string. This will cause
the encoding name string to be corrupted.

Consider the following code:

    Encoding.default_internal = Encoding::ASCII_8BIT
    names = Encoding.default_internal.names
    p names
    Encoding.default_internal = nil
    p names

It outputs:

    ["ASCII-8BIT", "BINARY", "internal"]
    ["ASCII-8BIT", "BINARY", "\x00\x00\x00\x00\x00\x00\x00\x00"]

Co-authored-by: Matthew Valentine-House &lt;matt@eightbitraptor.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) c7ce2f537f96ab2cf2f5fc2982d6147866ff5340: [Backport #20304] (#10311)</title>
<updated>2024-03-22T00:25:36+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>nurse@users.noreply.github.com</email>
</author>
<published>2024-03-22T00:25:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a24802e8fd7e05077256605885c82ffd8221bc94'/>
<id>a24802e8fd7e05077256605885c82ffd8221bc94</id>
<content type='text'>
Fix memory leak in setting encodings

	There is a memory leak in Encoding.default_external= and
	Encoding.default_internal= because the duplicated name is not freed
	when overwriting.

	    10.times do
	      1_000_000.times do
	        Encoding.default_internal = nil
	      end

	      puts `ps -o rss= -p #{$$}`
	    end

	Before:

	     25664
	     41504
	     57360
	     73232
	     89168
	    105056
	    120944
	    136816
	    152720
	    168576

	After:

	    9648
	    9648
	    9648
	    9680
	    9680
	    9680
	    9680
	    9680
	    9680
	    9680</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix memory leak in setting encodings

	There is a memory leak in Encoding.default_external= and
	Encoding.default_internal= because the duplicated name is not freed
	when overwriting.

	    10.times do
	      1_000_000.times do
	        Encoding.default_internal = nil
	      end

	      puts `ps -o rss= -p #{$$}`
	    end

	Before:

	     25664
	     41504
	     57360
	     73232
	     89168
	    105056
	    120944
	    136816
	    152720
	    168576

	After:

	    9648
	    9648
	    9648
	    9680
	    9680
	    9680
	    9680
	    9680
	    9680
	    9680</pre>
</div>
</content>
</entry>
<entry>
<title>Free everything at shutdown</title>
<updated>2023-12-07T20:52:35+00:00</updated>
<author>
<name>Adam Hess</name>
<email>adamhess1991@gmail.com</email>
</author>
<published>2023-10-12T18:15:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6816e8efcff3be75f8020cd1b0ea57d3cd664bbc'/>
<id>6816e8efcff3be75f8020cd1b0ea57d3cd664bbc</id>
<content type='text'>
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown.

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
when the RUBY_FREE_ON_SHUTDOWN environment variable is set, manually free memory at shutdown.

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;
Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Mark Encoding as Write Barrier protected</title>
<updated>2023-02-07T10:48:57+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>byroot@ruby-lang.org</email>
</author>
<published>2023-02-06T22:18:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=60c924770d6f0ce05c04c8c0a60a9bf23c79d85f'/>
<id>60c924770d6f0ce05c04c8c0a60a9bf23c79d85f</id>
<content type='text'>
It doesn't even have a mark function.
It's only about a hundred objects, but not reason
to scan them every time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It doesn't even have a mark function.
It's only about a hundred objects, but not reason
to scan them every time.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove Encoding#replicate</title>
<updated>2023-01-11T12:41:41+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2023-01-06T14:07:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6abe20e87b74a5a672dc59f72fa1f550ceab430c'/>
<id>6abe20e87b74a5a672dc59f72fa1f550ceab430c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>surpress warning</title>
<updated>2022-12-16T02:12:37+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2022-12-16T02:12:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=dbf77d420d49e541c59f4c14b8e56d3e7af689aa'/>
<id>dbf77d420d49e541c59f4c14b8e56d3e7af689aa</id>
<content type='text'>
now `enc_table-&gt;list` is not a pointer.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
now `enc_table-&gt;list` is not a pointer.
</pre>
</div>
</content>
</entry>
<entry>
<title>fixed encoding table</title>
<updated>2022-12-16T01:04:37+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2022-12-15T08:53:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ae19ac5b5ba1e613a788addeb6d4d67fa65f6518'/>
<id>ae19ac5b5ba1e613a788addeb6d4d67fa65f6518</id>
<content type='text'>
This reduces global lock acquiring for reading.
https://bugs.ruby-lang.org/issues/18949
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reduces global lock acquiring for reading.
https://bugs.ruby-lang.org/issues/18949
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove get_actual_encoding() and the dynamic endian detection for dummy UTF-16/UTF-32</title>
<updated>2022-09-12T12:02:34+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-09-10T17:15:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6525b6f760ccd9612c9546b0313ab1c7e4af5e66'/>
<id>6525b6f760ccd9612c9546b0313ab1c7e4af5e66</id>
<content type='text'>
* And simplify callers of get_actual_encoding().
* See [Feature #18949].
* See https://github.com/ruby/ruby/pull/6322#issuecomment-1242758474
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* And simplify callers of get_actual_encoding().
* See [Feature #18949].
* See https://github.com/ruby/ruby/pull/6322#issuecomment-1242758474
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate Encoding#replicate</title>
<updated>2022-09-10T17:02:15+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-09-03T10:46:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=14bcf69c9c36875c7956d0ec8c04bfeaec514dd1'/>
<id>14bcf69c9c36875c7956d0ec8c04bfeaec514dd1</id>
<content type='text'>
* See [Feature #18949].
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* See [Feature #18949].
</pre>
</div>
</content>
</entry>
</feed>
