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

[browser/WASM + .NET9] why is the garbage collector still not doing its job? #110100

Open
DierkDroth opened this issue Nov 23, 2024 · 6 comments
Open
Assignees
Labels
area-GC-mono os-browser Browser variant of arch-wasm untriaged New issue has not been triaged by the area owner

Comments

@DierkDroth
Copy link

Description

I had an open issue here which was closed as being fixed. However, it turns out that it's not fixed at all with .NET 9.

This made me update the repo to latest dependencies:
Minimal.zip

Scenario:

  • basically this is a small Platform UNO app, which can be compiled for WindowsAppSDK or Platform UNO WASM (which uses Blazor WASM)
  • WASM: by simply adding and removing elements to/from the visual tree the GC could be chased easily into an OutOfMemory exception
  • FAIK there is no memory leak in the minimal custom code, so it must be a problem with the WASM runtime/GC

I confirmed by working with @jeromelaban (CTO, Platform UNO) that this by no means is a Platform UNO issue but clearly a .NET WASM issue. He pointed out that adding GC.GetTotalMemory(true); to the code would workaround the issue. Please review the minimal code and the comments which I added.

WASM: Why is the GC not releasing memory for objects which are no longer in use? Why would I have to explicitly call GC.GetTotalMemory(true); to make sure the GC does its job?

Reproduction Steps

see above

Expected behavior

see above

Actual behavior

see above

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 23, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

@huoyaoyuan
Copy link
Member

The fix #108512 was not backported to 9.0.

@huoyaoyuan huoyaoyuan added area-GC-mono os-browser Browser variant of arch-wasm and removed area-GC-coreclr labels Nov 23, 2024
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad
See info in area-owners.md if you want to be subscribed.

@DierkDroth
Copy link
Author

@huoyaoyuan thanks for your feedback. So it only would be available with .NET10, correct?

@huoyaoyuan
Copy link
Member

You can raise a request for backport here. If approved, it will be available in future patches of 9.0.

@DierkDroth
Copy link
Author

Thanks for clarification @huoyaoyuan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GC-mono os-browser Browser variant of arch-wasm untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants