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

improve GC behavior for UGens; fix SndBuf FD cleanup #478

Merged
merged 4 commits into from
Nov 12, 2024
Merged

Conversation

gewang
Copy link
Member

@gewang gewang commented Nov 12, 2024

  1. UGens are still associated with origin shreds BUT are no longer reference counted by origin shreds
  2. remove all reference counting from UGen connection => and =^
  3. depend on the normal garbage collection to clean up UGen references in the code
  4. when UGen variables go out of scope (and refcount goes to 0), also disconnect itself from the UGen graph
  5. when a Shred is removed, it will detach associated UGens as before (minus ref-counting)

Now UGens are garbage collected and disconnected from all its UGen onnections, as soon as it is now longer referenced from code (previously, this was deferred until the end of origin shred the UGen was created on, which poses potentially significant memory build-up if a shred repeatedly instantiated/connected UGens without exiting). Overall, this internal update should result in improved CPU performance and memory behavior in various scenarios.

1) remove the special case of shreds remembering/ref-counting UGens created therein
2) remove all reference counting from UGen connection => and =^
3) depend on the normal garbage collection to clean up UGen references in the code
4) when UGen variables go out of scope (and refcount goes to 0), also disconnect itself from the UGen graph
@gewang gewang requested a review from nshaheed November 12, 2024 02:08
Copy link
Contributor

@nshaheed nshaheed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely nothing will break

@gewang gewang merged commit 5af226c into main Nov 12, 2024
4 checks passed
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.

2 participants