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

Memory Increases When Retrieving BindingPath.Path #9625

Closed
ChidanandMurugaiah opened this issue May 10, 2024 · 5 comments
Closed

Memory Increases When Retrieving BindingPath.Path #9625

ChidanandMurugaiah opened this issue May 10, 2024 · 5 comments
Labels
area-Binding area-Performance bug Something isn't working team-Markup Issue for the Markup team

Comments

@ChidanandMurugaiah
Copy link

ChidanandMurugaiah commented May 10, 2024

Describe the bug

I have a scenario where I need to retrieve the BindingPath.Path in various parts of my application multiple times. However, when I attempt to retrieve it, the memory usage spikes significantly, from 99mb to 710mb. Once the process is completed, it decreases back to 187mb. I have attached a video demonstration showcasing the memory consumption and provided a sample for your reference.

MemoryConsumption.zip

Steps to reproduce the bug

1.Run the sample.
2.Watch the process memory in the Diagnostic Tools or Task Manager.
3.Click Check button.

Expected behavior

Memory do not want to increase that much while retrieving the path.

Screenshots

MemoryConsumption_When_Retrieving_BindingPath.mp4

NuGet package version

WinUI 3 - Windows App SDK 1.5.3: 1.5.240428000

Windows version

No response

Additional context

No response

@ChidanandMurugaiah ChidanandMurugaiah added the bug Something isn't working label May 10, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 10, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@ChidanandMurugaiah
Copy link
Author

The mentioned concerns do not pertain to the problem I've reported here.

@codendone codendone added area-Binding team-Markup Issue for the Markup team area-Performance and removed needs-triage Issue needs to be triaged by the area owners labels May 10, 2024
@JesseCol
Copy link

Hi, thanks for posting. If you call GC.Collect() in this loop, do you still see this leak? Thanks!

@ChidanandMurugaiah
Copy link
Author

@JesseCol, Thank you for the update. We attempted your suggestion, and it did indeed resolve the memory leak. However, it introduced a performance issue. Without invoking GC.Collect(), the loop took 10 seconds to complete. Upon calling GC.Collect(), it took over 2 minutes to finish the loop. For your reference I attached the video demonstration with this update.

DataGrid_PerformanceIssue_with_GC.Collect().zip

@JesseCol
Copy link

Thanks! My suggestion of running GC.Collect() isn't that this would be a good way to fix the problem, it was just to see if there's a true memory leak here or if it's just that not all of the managed objects have been collected yet.

It sounds like what you're seeing here is normal CLR behavior. Your loop is allocating a lot of new objects, and they won't get cleaned up until the garbage collector runs. In a real-world app, you usually wouldn't call GC.Collect() yourself, you'd just let the CLR manage the memory itself.

@JesseCol JesseCol closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Binding area-Performance bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

3 participants