-
Notifications
You must be signed in to change notification settings - Fork 29
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
GC integration question #213
Comments
Yes, #203, #195, #187, #160, #159, and #49 all touch on this in various ways. Per #195, I'm mostly interested in pursuing enforcement as a follow-on proposal if it seems like it is necessary. With There are a large number of pre-exiting APIs across both the DOM and NodeJS that could readily adopt So, for additional discussion on (1) above, I would suggest you follow up in #195. There are also examples of potential mitigations that require no additional follow-up, such as making For (2) above, I brought up GC integration via |
For the This is for now the best you can have. |
For implementors of APIs that create objects that are expected to be explicitly disposed, the consumer of that API is under no obligation to actually use the
using
syntax, because it is not enforced.If they don't use the
using
syntax, there is still a risk the user does not dispose the resource, in which case having a GC finalizer can be beneficial.As an API creator, I would ideally want one of the following guarantees:
using
syntax so that they must dispose the resource.I think otherwise this risks APIs intended to be consumed in this way to be vulnerable to a memory leak footgun by consumers.
If the GC integration is done manually, this involves manual tracking of the dispose state in Symbol.dispose in conjunction with a finalization registration.
Has there been much discussion around improving this common scenario?
The text was updated successfully, but these errors were encountered: