Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix weak references count test #8402

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

eightbitraptor
Copy link
Contributor

This test creates a lot of Objects held in an array, and a set of weak references to them using WeakMap. It then clears the array and frees it and asserts that all the weak references to it are also gone.

This test is failing because one of the dummy objects in our weakmap is ending up on the stack, and so is being marked, even though we thought that we'd removed the only reference to it.

This behaviour has changed since commit: 5b5ae3d which rewrites Integer#times from C into Ruby. This change is somehow causing the last object we append to our array to consistently end up on the stack during GC.

This commit fixes the specific weakmap test by using an enumerator and each, instead of Integer#times, and thus avoids having our last object created end up on the stack.

This test creates a lot of Objects held in an array, and a set of weak
references to them using WeakMap. It then clears the array and frees it
and asserts that all the weak references to it are also gone.

This test is failing because one of the dummy objects in our weakmap is
ending up on the stack, and so is being marked, even though we thought
that we'd removed the only reference to it.

This behaviour has changed since this commit:

ruby@5b5ae3d

which rewrites `Integer#times` from C into Ruby. This change is somehow
causing the last object we append to our array to consistently end up on
the stack during GC.

This commit fixes the specific weakmap test by using an enumerator and
each, instead of `Integer#times`, and thus avoids having our last object
created end up on the stack.
@eightbitraptor eightbitraptor merged commit 7f53da9 into ruby:master Sep 8, 2023
93 checks passed
@eightbitraptor eightbitraptor deleted the mvh-fix-weakref-test branch September 8, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants