-
Notifications
You must be signed in to change notification settings - Fork 37.4k
reduce memory by ~1.2 MB #267785
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
reduce memory by ~1.2 MB #267785
Conversation
mjbvz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
Hi @mattbierner, Thanks for the review! I'm currently wondering about the failing unit test. It seems there was this code in Now this code doesn't exist anymore and it also seems a bit odd to me that someone would call Do you think the failing test can be removed? Thanks again. |
|
Thanks, yes I think we should remove that test. Our other disposable types ( |
Head branch was pushed to by a user without write access
|
Unsure about why the CI checks are failing. Re-running after merging to see if they are transient failures or need more investigation |
Pull request was converted to draft
|
Hm. Looks like it's always failing due to chat errors. I will try to see if I can reproduce the errors locally and maybe solve them. |
84da526
|
I checked and it's indeed the same error that also was in the unit test with the unbound this. Typescript doesn't catch these errors, but I checked with the typescript eslint rule Still needeing to track down further which of these 480 errors are relevant and which are not. |
For microsoft#267785 This pattern is not safe when working with an `IDisposable`
|
Ugh sorry this ended up being annoying and thanks for all the great follow up I found one very obvious case that could have caused the failure here: #268202. Will see if I spot any others. Hopefully we can avoid having to update all 480 locations as many are false positives |
|
Thanks very much! The tests are passing now. It might just have been that one occurrence. I'd say this is ready to merge now - but with a small chance of potentially breaking something. :) |
mjbvz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Overview
This changes the
toDisposablefunction to use a class so that there is one dispose function on the class prototype instead of a dispose closure created for eachtoDisposablefunction call.The memory savings seem to be ~1.2 MB.
Function overview chart
This function overview chart of vscode shows how many function instances exist of each function:
Notably at the top is
createSingleCallFunction, which is used bytoDisposable.Heapsnapshot before
Heapsnapshot after
Notable differences:
Functionsis reduced from 117165 to 96305closures (System Context)is reduced from 55728 to 35040{ dispose }objects is reduced from 11342 to 1192FunctionDisposablesincreases from 0 to 10087