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: Crystal::SpinLock doesn't need to be allocated on the HEAP #14972

Conversation

ysbaddaden
Copy link
Contributor

The object is a mere abstraction over an atomic integer and the object itself are only ever used internally of other objects and not shared, with the exception of Channel where the code explicitly accesses the ivar directly (still no copies).

We can avoid a HEAP allocation everywhere we use them (i.e. in lots of places).

Extracted from #14959

The abstraction is a mere abstraction over an atomic integer and the
object itself are only ever used internally of other objects, with the
exception of Channel where the code explicitely accesses the ivar
directly (thus not making copies).

We can avoid a HEAP allocation everywhere we use them (i.e. in lots of
places).
@straight-shoota straight-shoota added this to the 1.14.0 milestone Sep 5, 2024
@straight-shoota straight-shoota changed the title Fix: Crystal::SpinLock doesn't need to be allocated in the HEAP Fix: Crystal::SpinLock doesn't need to be allocated in the HEAP Sep 6, 2024
@straight-shoota straight-shoota changed the title Fix: Crystal::SpinLock doesn't need to be allocated in the HEAP Fix: Crystal::SpinLock doesn't need to be allocated on the HEAP Sep 6, 2024
@straight-shoota straight-shoota merged commit 85d1ae7 into crystal-lang:master Sep 6, 2024
59 of 61 checks passed
@ysbaddaden ysbaddaden deleted the fix/crystal-spinlock-as-struct branch September 6, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants