-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Windows Service memory grows indefinitely with Tracing and Profiling enabled. #3375
Comments
So there does appear to be an issue here. This is what I'm seeing when I run the service in a memory profiler: Although the LOH and POH do get cleaned up occassionally (somewhat), over time these just keep growing and growing. Heap Gen 0, 1 and 2 all appears stable. The only thing that I can think might be using the LOH or POH is profiling, which might need to pin objects when passing pointers to unsafe code. I see a number of instances where the PerView module pins objects (e.g. here). That's consistent with the call tree, which indicates 99% of the memory is being used by instances of The It looks like the ProcessEventBlock method creates multiple I'll play around to see if I can explicitly free these up. |
When I look at the generations I can see: Pretty much all of that is accounted for by ![]() I see events get added to that stack here but the only place I see them being removed is in the internal FlushRealtimeEvents method, which in turn gets called by TraceLogProcess, which we call here when starting the profiling:
As far as I can tell then, that GrowableArray just gets bigger and bigger, and there are no public APIs that we can use to flush out old item. @vaind any ideas? |
@jamescrosswell any chance you could verify the fix in #3382 ? |
It works - thanks @vaind!🕺🏻 ![]() |
thank you! for reference: this was the actual fix: microsoft/perfview@36d2e2c#diff-31ffbfdad96fc84f3aa7d25e1980cdca5a4d7870529c669ac9cc975cf24969c8R342 |
From jforward5 on Discord.
Demo project to reproduce
Memory Test Worker Service.zip
The text was updated successfully, but these errors were encountered: