<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>GC</title><link>https://blog.ast.moe/en/tags/gc/</link><description>Recent posts: Gorimuchu</description><generator>Hugo</generator><item><title>After implementing Omoikane’s DOM and exception notifications, we ended up investigating copying and garbage‑collection lifetimes as well.</title><link>https://blog.ast.moe/en/blog/2026-10-10/</link><pubDate>Sat, 10 Oct 2026 17:42:29 +0900</pubDate><guid>https://blog.ast.moe/en/blog/2026-10-10/</guid><description>&lt;p&gt;We added DOM operations such as &lt;code&gt;before()&lt;/code&gt; and &lt;code&gt;replaceChildren()&lt;/code&gt; to Omoikane, along with &lt;code&gt;window.onerror&lt;/code&gt; and notifications for unhandled Promise rejections. [&lt;a href="https://github.com/ieee0824/omoikane/pull/1322"&gt;PR #1322&lt;/a&gt;](&lt;a href="https://github.com/ieee0824/omoikane/pull/1322"&gt;https://github.com/ieee0824/omoikane/pull/1322&lt;/a&gt;) This is about that pull request. The initial issue was straightforward: the page lacked the APIs it normally calls. However, as we progressed with implementation and testing, we ended up fixing issues such as copying sibling lists when inserting HTML text, rebuilding the entire document after UTF‑16 appends, creating unnecessary iframe realms, and even addressing insufficient GC roots for Promises.&lt;/p&gt;</description></item><item><title>WeakMap and Generational Garbage Collection</title><link>https://blog.ast.moe/en/blog/2026-10-08-2/</link><pubDate>Thu, 08 Oct 2026 21:52:45 +0900</pubDate><guid>https://blog.ast.moe/en/blog/2026-10-08-2/</guid><description>&lt;p&gt;Opening &lt;code&gt;https://tokyo6.tokyo/&lt;/code&gt; with Omoikane caused a bug where the script terminated with a SIGSEGV during execution. Issue #1223 (&lt;a href="https://github.com/ieee0824/omoikane/issues/1223"&gt;issue #1223&lt;/a&gt;) reproduces the problem not only in the GUI but also in the screenshot feature that renders the screen to an image. The backtrace from the debug build reproduced on a Linux aarch64 Docker development environment with Xvfb showed that Boa’s garbage collector halted while traversing references to an object.&lt;/p&gt;
&lt;p&gt;The fix in &lt;a href="https://github.com/ieee0824/omoikane/pull/1260"&gt;PR #1260&lt;/a&gt; (&lt;a href="https://github.com/ieee0824/omoikane/pull/1260"&gt;PR #1260&lt;/a&gt;) addressed the combination of an ephemeron—a conditional reference—and the generational garbage collector. A young object that was referenced by an older object was being reclaimed during the minor GC that followed a major GC. Subsequently, the major GC followed a reference that had already been freed, causing a crash.&lt;/p&gt;</description></item><item><title>What is a WeakMap?</title><link>https://blog.ast.moe/en/blog/2026-10-08/</link><pubDate>Thu, 08 Oct 2026 21:50:47 +0900</pubDate><guid>https://blog.ast.moe/en/blog/2026-10-08/</guid><description>&lt;p&gt;JavaScript has &lt;code&gt;Map&lt;/code&gt;, which stores key‑value pairs, and a similarly named &lt;code&gt;WeakMap&lt;/code&gt;. Both can be registered with &lt;code&gt;set()&lt;/code&gt; and retrieved with &lt;code&gt;get()&lt;/code&gt;. However, WeakMap does not have &lt;code&gt;size&lt;/code&gt; nor &lt;code&gt;keys()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A WeakMap is a mechanism that associates information with objects without keeping the objects in memory solely because of that association. The term “weak” refers not to the data’s reliability or the accuracy of lookups, but to how the references to the keys are treated.&lt;/p&gt;</description></item><item><title>The object returned by Boa’s getter was collected by the garbage collector while the inline cache was being updated.</title><link>https://blog.ast.moe/en/blog/2026-09-30/</link><pubDate>Wed, 30 Sep 2026 08:12:00 +0900</pubDate><guid>https://blog.ast.moe/en/blog/2026-09-30/</guid><description>&lt;p&gt;When running the test for a custom element associated with a form in Omoikane’s Web Platform Tests (WPT), it caused a SIGSEGV. The first occurrence was in a configuration that included the JIT, so we initially suspected an interaction between Boa’s JIT or its garbage collector. However, even when the JIT was disabled, the same crash could be reproduced (&lt;a href="https://github.com/ieee0824/omoikane/issues/858#issuecomment-5890658215"&gt;issue #858&lt;/a&gt;), and ultimately the problem lay in a tiny interval between when the getter’s returned object was produced and when it was stored in the VM’s registers.&lt;/p&gt;</description></item><item><title>A SIGSEGV occurred after garbage collection because the iterator function passed to Boa’s Array.from was not properly retained.</title><link>https://blog.ast.moe/en/blog/2026-09-25/</link><pubDate>Fri, 25 Sep 2026 08:46:00 +0900</pubDate><guid>https://blog.ast.moe/en/blog/2026-09-25/</guid><description>&lt;p&gt;While running Omoikane’s Acid3 test, the process hit a SIGSEGV under the baseline JIT configuration on macOS ARM64. I briefly mentioned this in the earlier blog post about Omoikane updates, but the cause wasn’t the test itself nor the JIT’s machine‑code generation; it lay in the Boa code we’re incorporating, specifically in the &lt;code&gt;Array.from()&lt;/code&gt; section. Omoikane incorporates Boa’s source code together with the browser‑side implementation, so the fix was also applied to the engine that pulls in that code. (&lt;a href="https://blog.ast.moe/en/blog/2026-09-20/"&gt;source&lt;/a&gt;)&lt;/p&gt;</description></item><item><title>I investigated why Acid3 was crashing due to memory errors in Omoikane’s baseline JIT.</title><link>https://blog.ast.moe/en/blog/2026-09-13/</link><pubDate>Sun, 13 Sep 2026 20:20:51 +0900</pubDate><guid>https://blog.ast.moe/en/blog/2026-09-13/</guid><description>&lt;p&gt;While working on implementing CSS in my own browser, Omoikane (&lt;a href="https://github.com/ieee0824/omoikane"&gt;source&lt;/a&gt;), Acid3 began crashing due to memory errors.&lt;/p&gt;
&lt;p&gt;The problem only occurs when the baseline JIT is enabled; it runs fine with the interpreter.&lt;/p&gt;
&lt;p&gt;Furthermore, Omoikane’s Acid3 runner has two execution modes, Faithful and DirectDrive. Faithful completes all 100 points, but then it crashes during DirectDrive.&lt;/p&gt;
&lt;p&gt;The failure manifests differently depending on the environment.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Environment&lt;/th&gt;
&lt;th&gt;Observed failure&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;x86_64 Linux&lt;/td&gt;
&lt;td&gt;SIGSEGV&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARM64 Linux&lt;/td&gt;
&lt;td&gt;SIGABRT, ~60 GB allocation, SIGSEGV on rerun&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARM64 macOS&lt;/td&gt;
&lt;td&gt;SIGSEGV, SIGBUS on rerun&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Even though it’s the same test, the signals differ.&lt;/p&gt;</description></item></channel></rss>