<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/random.c, branch v3_4_9</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) 1181a682a6c314c92686e3701defa1eb44068c4e, d84a811f31a65821642b165d712f380c0cc060e0: [Backport #21448]</title>
<updated>2025-07-14T21:29:57+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-07-14T21:29:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=508daebdcd730e34d5fb750880249deae8025b80'/>
<id>508daebdcd730e34d5fb750880249deae8025b80</id>
<content type='text'>
	[Bug #21448] Use `getentropy(2)` only on macOS

	If this is not a system call, then it is using getrandom (which would
	have been tried already), and cannot be used as a replacement for the
	random devices.

	[Bug #21448] Reorder trials in `fill_random_bytes`

	First try dedicated system calls, such as `getrandom` or `getentropy`,
	next possible libraries, then fallback to `/dev/urandom`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #21448] Use `getentropy(2)` only on macOS

	If this is not a system call, then it is using getrandom (which would
	have been tried already), and cannot be used as a replacement for the
	random devices.

	[Bug #21448] Reorder trials in `fill_random_bytes`

	First try dedicated system calls, such as `getrandom` or `getentropy`,
	next possible libraries, then fallback to `/dev/urandom`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove a useless condition expression</title>
<updated>2024-11-29T15:03:07+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-11-29T14:33:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8aeb67de7dd9c8cf505985be45cd0efcea88f895'/>
<id>8aeb67de7dd9c8cf505985be45cd0efcea88f895</id>
<content type='text'>
`len` is always at least 1 here.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`len` is always at least 1 here.
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid illegal pointer</title>
<updated>2024-11-28T18:01:46+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-11-28T17:16:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=50a34637a4bdd64a709937f09c839195a2b1d967'/>
<id>50a34637a4bdd64a709937f09c839195a2b1d967</id>
<content type='text'>
When loading a crafted marshal data of Random, a pointer to an illegal
address was created. I don't think there is any harm since the data is
normalized before access, but just to be safe, I add a check to make it
an error.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When loading a crafted marshal data of Random, a pointer to an illegal
address was created. I don't think there is any harm since the data is
normalized before access, but just to be safe, I add a check to make it
an error.
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not try random devices immediately twice</title>
<updated>2024-06-07T01:42:41+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-06-06T18:15:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=335cb28886dda81b5c3dad1bb02cf7b7450e05e9'/>
<id>335cb28886dda81b5c3dad1bb02cf7b7450e05e9</id>
<content type='text'>
Do not retry `fill_random_bytes` in `Init_RandomSeedCore`, just after
it failed first.

In other places, `rand_init_default` and `random_seed`, no more tweeks
needed once it succeeded
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Do not retry `fill_random_bytes` in `Init_RandomSeedCore`, just after
it failed first.

In other places, `rand_init_default` and `random_seed`, no more tweeks
needed once it succeeded
</pre>
</div>
</content>
</entry>
<entry>
<title>win32: Allocate the wrapper for crypt provider handle first</title>
<updated>2024-06-07T01:42:41+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-06-06T01:34:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5b4734d51d8504e3b4152d54f26cdeaef0957b8c'/>
<id>5b4734d51d8504e3b4152d54f26cdeaef0957b8c</id>
<content type='text'>
Also use a typed data.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also use a typed data.
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor VM root modules</title>
<updated>2024-03-06T20:33:43+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>byroot@ruby-lang.org</email>
</author>
<published>2024-03-03T09:46:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d4f3dcf4dff80ded472ba3061e62c6c676ffab8c'/>
<id>d4f3dcf4dff80ded472ba3061e62c6c676ffab8c</id>
<content type='text'>
This `st_table` is used to both mark and pin classes
defined from the C API. But `vm-&gt;mark_object_ary` already
does both much more efficiently.

Currently a Ruby process starts with 252 rooted classes,
which uses `7224B` in an `st_table` or `2016B` in an `RArray`.

So a baseline of 5kB saved, but since `mark_object_ary` is
preallocated with `1024` slots but only use `405` of them,
it's a net `7kB` save.

`vm-&gt;mark_object_ary` is also being refactored.

Prior to this changes, `mark_object_ary` was a regular `RArray`, but
since this allows for references to be moved, it was marked a second
time from `rb_vm_mark()` to pin these objects.

This has the detrimental effect of marking these references on every
minors even though it's a mostly append only list.

But using a custom TypedData we can save from having to mark
all the references on minor GC runs.

Addtionally, immediate values are now ignored and not appended
to `vm-&gt;mark_object_ary` as it's just wasted space.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This `st_table` is used to both mark and pin classes
defined from the C API. But `vm-&gt;mark_object_ary` already
does both much more efficiently.

Currently a Ruby process starts with 252 rooted classes,
which uses `7224B` in an `st_table` or `2016B` in an `RArray`.

So a baseline of 5kB saved, but since `mark_object_ary` is
preallocated with `1024` slots but only use `405` of them,
it's a net `7kB` save.

`vm-&gt;mark_object_ary` is also being refactored.

Prior to this changes, `mark_object_ary` was a regular `RArray`, but
since this allows for references to be moved, it was marked a second
time from `rb_vm_mark()` to pin these objects.

This has the detrimental effect of marking these references on every
minors even though it's a mostly append only list.

But using a custom TypedData we can save from having to mark
all the references on minor GC runs.

Addtionally, immediate values are now ignored and not appended
to `vm-&gt;mark_object_ary` as it's just wasted space.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use STATIC_ASSERT</title>
<updated>2024-01-13T14:43:07+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-01-13T14:41:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=55335eab80d763fb11d621c041d23aaf8f4857c6'/>
<id>55335eab80d763fb11d621c041d23aaf8f4857c6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</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>[DOC] Improve Random::Formatter docs</title>
<updated>2022-12-11T16:49:56+00:00</updated>
<author>
<name>zverok</name>
<email>zverok.offline@gmail.com</email>
</author>
<published>2022-01-12T20:05:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=381a373ab92e2a5869e75f43815993cef39d32cf'/>
<id>381a373ab92e2a5869e75f43815993cef39d32cf</id>
<content type='text'>
* Make its usage more obvious (by providing more detailed
  examples);
* Include mention of it into Random itself;
* Small cleanups of docs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Make its usage more obvious (by providing more detailed
  examples);
* Include mention of it into Random itself;
* Small cleanups of docs.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19100] Add `init_int32` function to `rb_random_interface_t`</title>
<updated>2022-11-10T03:06:13+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-11-09T10:36:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b7e8876704648cee6866591ac1aca7a54faff742'/>
<id>b7e8876704648cee6866591ac1aca7a54faff742</id>
<content type='text'>
Distinguish initialization by single word from initialization by
array.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Distinguish initialization by single word from initialization by
array.
</pre>
</div>
</content>
</entry>
</feed>
