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

SClang: PyrGC calls own methods in its constructor before fully initialised. #6268

Open
JordanHendersonMusic opened this issue Apr 24, 2024 · 0 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"

Comments

@JordanHendersonMusic
Copy link
Contributor

Environment

  • SuperCollider version: 3.14 - dev

Steps to reproduce

This isn't a problem in current use. However, #6261 introduces a limit on the number of objects to be scanned, which when set absurdly low (<1000) triggers the constructor of PyrGC to call its own member functions in the constructor before it is fully initialised, leading to a segfault. This is during the initialisation of the mProcess member (a PyrProcess).

Specifically:

The circular call into itself starts on this line,

mProcess = newPyrProcess(g, mainProcessClass);

requiring mStack and g-> sp to be set, which don't happen until the next line or so.

This is less of a bug, because the behaviour will never be triggered, and more a case of incorrect design, albeit, quite a nuanced issue as dealing with an allocator that needs to call itself to allocate its component parts is circular.

As an improvement I suggest, either:

  • the allocator should have some special methods, or even a boolean flag, that prevent it from attempting to collect while uninitialised — ugly, but simple,
  • or, a different allocator should be used when initialising this object — this might not be possible,

Alternatively, this could just be ignored, but if the 'magic' number of the GC change, this issue might be triggered.

@JordanHendersonMusic JordanHendersonMusic added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library" labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: sclang sclang C++ implementation (primitives, etc.). for changes to class lib use "comp: class library"
Projects
None yet
Development

No branches or pull requests

1 participant