Skip to content

fix: template literal OOM error caused by child elements not visible to GC in staticArray - #3039

Open
KKiiim wants to merge 1 commit into
AssemblyScript:mainfrom
KKiiim:fix/static-array
Open

fix: template literal OOM error caused by child elements not visible to GC in staticArray#3039
KKiiim wants to merge 1 commit into
AssemblyScript:mainfrom
KKiiim:fix/static-array

Conversation

@KKiiim

@KKiiim KKiiim commented Aug 20, 2026

Copy link
Copy Markdown

Root cause:

When AssemblyScript compiles a template literal for string concatenation, the compiler generates a static StaticArray<string> as an intermediate buffer. This static array resides in the data segment with its ITCMS GC header gcInfo set to 3 (transparent/pinned color), but the object is neither linked into the pinSpace linked list nor visited by __visit_globals (which explicitly skips static GC objects). As a result, the GC has no way to trace the dynamic child strings written into the array via __uset, and may incorrectly collect strings that are still in use — leading to rtSize corruption, memory corruption, and eventual trap crashes.

@KKiiim KKiiim changed the title fix(as): template literal OOM error caused by child elements not visible to GC in staticArray fix: template literal OOM error caused by child elements not visible to GC in staticArray Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant