Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kyri-petrou
Copy link
Contributor

@kyri-petrou kyri-petrou commented Mar 27, 2025

/fixes #9709

To be honest, it's a bit of a mystery to me on why this approach does not add the initial value as a class field to Atomic but the previous approach does. By instantiating the AtomicRef without a value and then setting its value we avoid adding the initial value as a class field which means it can be GC'd once its value is removed from Ref

@kyri-petrou kyri-petrou requested a review from hearnadam March 27, 2025 06:28
@kyri-petrou kyri-petrou marked this pull request as ready for review March 27, 2025 06:28
@kyri-petrou kyri-petrou merged commit 6a28982 into zio:series/2.x Mar 27, 2025
18 checks passed
@kyri-petrou kyri-petrou deleted the allow-ref-initial-value-to-be-gcd branch March 27, 2025 08:40
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.

Suboptimal memory usage for zio.Atomic (inside zio.Ref)

2 participants