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

Resources should need only one submission to be released #4917

Closed
gents83 opened this issue Dec 21, 2023 · 3 comments · Fixed by #5050
Closed

Resources should need only one submission to be released #4917

gents83 opened this issue Dec 21, 2023 · 3 comments · Fixed by #5050
Assignees
Labels
type: enhancement New feature or request

Comments

@gents83
Copy link
Contributor

gents83 commented Dec 21, 2023

In mem_leaks.rs we can see that it has been modified to add 2 consecutive poll.
This should not be necessary.
Resources should be released in a specific order to avoid keeping as marked to be used resourced that should not be used anymore.

image

Expected behavior:
In a single submission all resources even with dependencies should be released

Tagging @nical & @jimblandy for info

@nical
Copy link
Contributor

nical commented Dec 26, 2023

My take is that we should not attempt to release resource in a specific order and just let the Arcs do their thing (if there is a particular order to preserve, then model it with strong references). This means that we stop conditionally retaining resources in the triage_* functions based on their reference count (I believe that's what prevents some resources from being released in a single polling step of the device.

@gents83
Copy link
Contributor Author

gents83 commented Dec 27, 2023

True, but we've to solve this problem.
Since some resources keep some Arc to other resources and we want to be sure that in 1 submit we need to be sure to release before the one holding refs to others.
Otherwise they will not be released in the same frame.
So basically what the triage was doing is:
If A has an Arc reference of B, then we've first to remove the reference and then release A, so B will result as a lonely reference and can be released.
Maybe we could find a smarter alternative?

@teoxoy teoxoy added the type: enhancement New feature or request label Jan 2, 2024
@nical
Copy link
Contributor

nical commented Jan 2, 2024

I am in the middle of a fair amount of churn in the resource deallocation logic, and there was the winter break but I'm hoping to get to all of this soon.

The alternative I'm hoping for is the simple/dumb one: When A is dropped, it drops the reference of B. If A was the only thing holding B alive, then B naturally gets deallocated immediately after A.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants