<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_module.rb, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 3b7892b6e4d1a1a5d6019987f9b46ed443dd104f: [Backport #20871]</title>
<updated>2024-11-30T05:29:18+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-11-30T05:29:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bb065f08441aab8f97b45bd3f1600202547c9532'/>
<id>bb065f08441aab8f97b45bd3f1600202547c9532</id>
<content type='text'>
	Fix a bug in rb_include_module that stops nested inclusion into module subclasses

	This bug was present since the code was originally added by me
	in 3556a834a2847e52162d1d3302d4c64390df1694.

	Fixes [Bug #20871]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix a bug in rb_include_module that stops nested inclusion into module subclasses

	This bug was present since the code was originally added by me
	in 3556a834a2847e52162d1d3302d4c64390df1694.

	Fixes [Bug #20871]
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) ac0163949a6ee678dfccec9f6e56422b91e5f0a9,01fd262e62076277a41af72ea13f20deb1b462a2: [Backport #20245]</title>
<updated>2024-03-31T08:37:01+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-03-31T08:37:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=27606daf8efeb0ae6d0590a2c9bb1c5aae07f140'/>
<id>27606daf8efeb0ae6d0590a2c9bb1c5aae07f140</id>
<content type='text'>
	Compile code without Symbol GC always

	---
	 symbol.c | 28 +++++++++++++---------------
	 1 file changed, 13 insertions(+), 15 deletions(-)

	Fix crash when checking symbol encoding

	[Bug #20245]

	We sometimes pass in a fake string to sym_check_asciionly. This can crash
	if sym_check_asciionly raises because it creates a CFP with the fake
	string as the receiver which will crash if GC tries to mark the CFP.

	For example, the following script crashes:

	    GC.stress = true
	    Object.const_defined?("\xC3")
	---
	 symbol.c                 | 17 ++++++++++-------
	 test/ruby/test_module.rb |  8 ++++++++
	 2 files changed, 18 insertions(+), 7 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Compile code without Symbol GC always

	---
	 symbol.c | 28 +++++++++++++---------------
	 1 file changed, 13 insertions(+), 15 deletions(-)

	Fix crash when checking symbol encoding

	[Bug #20245]

	We sometimes pass in a fake string to sym_check_asciionly. This can crash
	if sym_check_asciionly raises because it creates a CFP with the fake
	string as the receiver which will crash if GC tries to mark the CFP.

	For example, the following script crashes:

	    GC.stress = true
	    Object.const_defined?("\xC3")
	---
	 symbol.c                 | 17 ++++++++++-------
	 test/ruby/test_module.rb |  8 ++++++++
	 2 files changed, 18 insertions(+), 7 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) c42261059dfebabbf0391327a5e077545a9bc438: [Backport #19901]</title>
<updated>2023-09-30T04:47:33+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-09-30T04:47:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a191cf561786bde3d0b7d298aab1fbeb1051645c'/>
<id>a191cf561786bde3d0b7d298aab1fbeb1051645c</id>
<content type='text'>
	[Bug #19901]

	fix leak in module clone

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 class.c                  |  1 +
	 test/ruby/test_module.rb | 12 ++++++++++++
	 2 files changed, 13 insertions(+)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19901]

	fix leak in module clone

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 class.c                  |  1 +
	 test/ruby/test_module.rb | 12 ++++++++++++
	 2 files changed, 13 insertions(+)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 8b236e0c66da8f92e9fc33de66cfbc8e4b0c0763: [Backport #19896]</title>
<updated>2023-09-30T04:46:29+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-09-30T04:46:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=97b7070ebd5493de8d3a6a9b0ecc91bef5068d3f'/>
<id>97b7070ebd5493de8d3a6a9b0ecc91bef5068d3f</id>
<content type='text'>
	[Bug #19896]

	fix memory leak in vm_method

	This introduces a unified reference_count to clarify who is referencing a method.
	This also allows us to treat the refinement method as the def owner since it counts itself as a reference

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 gc.c                     |   4 +-
	 method.h                 |   6 +--
	 rjit_c.rb                |   6 +--
	 test/ruby/test_module.rb |   4 +-
	 vm_insnhelper.c          |   2 +-
	 vm_method.c              | 105 +++++++++++++++++++----------------------------
	 6 files changed, 54 insertions(+), 73 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19896]

	fix memory leak in vm_method

	This introduces a unified reference_count to clarify who is referencing a method.
	This also allows us to treat the refinement method as the def owner since it counts itself as a reference

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 gc.c                     |   4 +-
	 method.h                 |   6 +--
	 rjit_c.rb                |   6 +--
	 test/ruby/test_module.rb |   4 +-
	 vm_insnhelper.c          |   2 +-
	 vm_method.c              | 105 +++++++++++++++++++----------------------------
	 6 files changed, 54 insertions(+), 73 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 96c5a4be7b0d72502001734770af0f4a735c544c: [Backport #19894]</title>
<updated>2023-09-24T06:13:32+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-09-24T06:13:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9ee58b2054c1bbe722ae5a2a4ec6a750ee583220'/>
<id>9ee58b2054c1bbe722ae5a2a4ec6a750ee583220</id>
<content type='text'>
	Fix memory leak in complemented method entries

	[Bug #19894]

	When a copy of a complemented method entry is created, there are two
	issues:

	1. IMEMO_FL_USER3 is not copied, so the complemented status is not
	   copied over.
	2. In rb_method_entry_clone we increment both alias_count and
	   complemented_count. However, when we free the method entry in
	   rb_method_definition_release, we only decrement one of the two
	   counters, resulting in the rb_method_definition_t being leaked.

	Co-authored-by: Adam Hess &lt;adamhess1991@gmail.com&gt;
	---
	 method.h                 |  5 +++--
	 test/ruby/test_module.rb | 29 +++++++++++++++++++++++++++++
	 vm_method.c              |  8 +++++---
	 3 files changed, 37 insertions(+), 5 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix memory leak in complemented method entries

	[Bug #19894]

	When a copy of a complemented method entry is created, there are two
	issues:

	1. IMEMO_FL_USER3 is not copied, so the complemented status is not
	   copied over.
	2. In rb_method_entry_clone we increment both alias_count and
	   complemented_count. However, when we free the method entry in
	   rb_method_definition_release, we only decrement one of the two
	   counters, resulting in the rb_method_definition_t being leaked.

	Co-authored-by: Adam Hess &lt;adamhess1991@gmail.com&gt;
	---
	 method.h                 |  5 +++--
	 test/ruby/test_module.rb | 29 +++++++++++++++++++++++++++++
	 vm_method.c              |  8 +++++---
	 3 files changed, 37 insertions(+), 5 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 417b1a36447cb2c650de55b433ba623541fb8bb3: [Backport #19550]</title>
<updated>2023-07-17T00:29:04+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-07-17T00:29:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9fb94407b97bb85ea344e67606f8ae9ba0bdbd48'/>
<id>9fb94407b97bb85ea344e67606f8ae9ba0bdbd48</id>
<content type='text'>
	Fix memory leak for iclass

	[Bug #19550]

	If !RCLASS_EXT_EMBEDDED (e.g. 32 bit systems) then the rb_classext_t is
	allocated throug malloc so it must be freed.

	The issue can be seen in the following script:

	```
	20.times do
	  100_000.times do
	    mod = Module.new
	    Class.new do
	      include mod
	    end
	  end

	  # Output the Resident Set Size (memory usage, in KB) of the current Ruby process
	  puts `ps -o rss= -p #{$$}`
	end
	```

	Before this fix, the max RSS is 280MB, while after this change, it's
	30MB.
	---
	 gc.c                     |  2 +-
	 test/ruby/test_module.rb | 15 +++++++++++++++
	 2 files changed, 16 insertions(+), 1 deletion(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix memory leak for iclass

	[Bug #19550]

	If !RCLASS_EXT_EMBEDDED (e.g. 32 bit systems) then the rb_classext_t is
	allocated throug malloc so it must be freed.

	The issue can be seen in the following script:

	```
	20.times do
	  100_000.times do
	    mod = Module.new
	    Class.new do
	      include mod
	    end
	  end

	  # Output the Resident Set Size (memory usage, in KB) of the current Ruby process
	  puts `ps -o rss= -p #{$$}`
	end
	```

	Before this fix, the max RSS is 280MB, while after this change, it's
	30MB.
	---
	 gc.c                     |  2 +-
	 test/ruby/test_module.rb | 15 +++++++++++++++
	 2 files changed, 16 insertions(+), 1 deletion(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Module#remove_method: Check frozen on the right object</title>
<updated>2022-12-01T22:32:41+00:00</updated>
<author>
<name>Jean byroot Boussier</name>
<email>jean.boussier+github@shopify.com</email>
</author>
<published>2022-12-01T22:32:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3d272b0fc822f5c2e9c716377b7fcecf15426b27'/>
<id>3d272b0fc822f5c2e9c716377b7fcecf15426b27</id>
<content type='text'>
Previously, the frozen check happened on `RCLASS_ORIGIN(self)`, which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.

Fixes [Bug #19164] and [Bug #19166].

Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the frozen check happened on `RCLASS_ORIGIN(self)`, which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.

Fixes [Bug #19164] and [Bug #19166].

Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Skip test_redefinition_mismatch on trunk-mjit for now</title>
<updated>2022-09-06T06:40:13+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-09-06T06:40:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f4dbfa0f04448386a662611682adf6b2219089a4'/>
<id>f4dbfa0f04448386a662611682adf6b2219089a4</id>
<content type='text'>
Investigating:
http://ci.rvm.jp/logfiles/brlog.trunk-mjit.20220906-025646
which is not immediately reproducible on my laptop.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Investigating:
http://ci.rvm.jp/logfiles/brlog.trunk-mjit.20220906-025646
which is not immediately reproducible on my laptop.
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not have class/module keywords look up ancestors of Object</title>
<updated>2022-07-21T15:28:05+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-06-20T22:51:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=12ac8971a394118a57640299f654e46e763093fa'/>
<id>12ac8971a394118a57640299f654e46e763093fa</id>
<content type='text'>
Fixes case where Object includes a module that defines a constant,
then using class/module keyword to define the same constant on
Object itself.

Implements [Feature #18832]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes case where Object includes a module that defines a constant,
then using class/module keyword to define the same constant on
Object itself.

Implements [Feature #18832]
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Module#undefined_instance_methods</title>
<updated>2022-06-06T16:57:32+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-06-06T16:57:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7cda7fbbdc14f4262afaa94cdeb5a5987f1eb01a'/>
<id>7cda7fbbdc14f4262afaa94cdeb5a5987f1eb01a</id>
<content type='text'>
Implements [Feature #12655]

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implements [Feature #12655]

Co-authored-by: Nobuyoshi Nakada &lt;nobu@ruby-lang.org&gt;</pre>
</div>
</content>
</entry>
</feed>
