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

Cannot destroy a busy fiber #258

Open
vtereshkov opened this issue Dec 18, 2022 · 0 comments
Open

Cannot destroy a busy fiber #258

vtereshkov opened this issue Dec 18, 2022 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@vtereshkov
Copy link
Owner

vtereshkov commented Dec 18, 2022

Fibers are unable to free the allocated heap if their functions have not returned in a regular way. This caused memory leaks, such as #16 and #255. To make the behavior more predictable and easier to analyze, any attempt to free a fiber variable whose function has not returned is now treated as an error:

fn main() {
        for i := 0; i < 10000; i++ {
                ctx := new(int)
                resume(make(fiber, |ctx| {
                    a := make([]int, 10000)
                    resume()
                }))
        }                                        // Runtime error: Cannot destroy a busy fiber
}

It is, however, very inconvenient for the user to care about how to terminate every fiber properly.

@vtereshkov vtereshkov added the enhancement New feature or request label Dec 18, 2022
@vtereshkov vtereshkov added the bug Something isn't working label Feb 12, 2023
@vtereshkov vtereshkov changed the title Cannot destroy a fiber that did not return Cannot destroy a busy fiber Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant