Giter Site home page Giter Site logo

Comments (5)

jamescrosswell avatar jamescrosswell commented on June 26, 2024 1

@jamescrosswell any chance you could verify the fix in #3382 ?

It works - thanks @vaind!πŸ•ΊπŸ»

image

from sentry-dotnet.

vaind avatar vaind commented on June 26, 2024 1

thank you!

for reference: this was the actual fix: microsoft/perfview@36d2e2c#diff-31ffbfdad96fc84f3aa7d25e1980cdca5a4d7870529c669ac9cc975cf24969c8R342

from sentry-dotnet.

jamescrosswell avatar jamescrosswell commented on June 26, 2024

So there does appear to be an issue here. This is what I'm seeing when I run the service in a memory profiler:
image

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 EventMarker, which is an internal class used by modules/perfview/src/TraceEvent/EventPipe/EventCache.cs:
image

The EventMarker constructor takes a PinnedBuffer as an argument.

It looks like the ProcessEventBlock method creates multiple EventMarker instances and never explicitly cleans any of these up.

I'll play around to see if I can explicitly free these up.

from sentry-dotnet.

jamescrosswell avatar jamescrosswell commented on June 26, 2024

When I look at the generations I can see:
image

Pretty much all of that is accounted for by Microsoft.Diagnostics.Tracing.Etlx.TraceLog+EventsToStackIndex[]

image

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:

Task.Factory.StartNew(eventSource.Process, TaskCreationOptions.LongRunning)

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?

from sentry-dotnet.

vaind avatar vaind commented on June 26, 2024

@jamescrosswell any chance you could verify the fix in #3382 ?

from sentry-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.