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

TRACY_ON_DEMAND consumes memory infinitely #789

Closed
FedyuninV opened this issue May 10, 2024 · 4 comments
Closed

TRACY_ON_DEMAND consumes memory infinitely #789

FedyuninV opened this issue May 10, 2024 · 4 comments

Comments

@FedyuninV
Copy link

FedyuninV commented May 10, 2024

Hi, @wolfpld!

I'm developing an app which:

  1. stays online for a long time (kind of a service)
  2. when needed, can be profiled with Tracy on the fly

TRACY_ON_DEMAND was a lifesaver for me but when process lives for a long time the tracy::Profiler::m_deferredQueue grows infinitely and consumes too much memory. Do you have any ideas how to limit this queue? E.g. some smart clean-up which removes the oldest events and guarantees that remaining ones won't cause Discontinuous frame begin/end mismatch..

Right now it's a private field without any mechanism to get access to it or clean it up via Tracy.

P.S. Thanks for the cool tool!

@wolfpld
Copy link
Owner

wolfpld commented May 10, 2024

The deferred queue should, by design, hold a small number of items needed to properly set up the initial state of things created in the past that newly arriving messages can reference. What kind of things do you see being put there in excess? You can check this by breaking in tracy::Profiler::DeferIteem().

@FedyuninV
Copy link
Author

The idea was to launch a service (without connecting to Tracy) and connect to it only when something happens. There is a chance that Tracy server will connect to the profiled process after hours (or even days) of work.

@kekangshu99
Copy link

Maybe you can try to start Tracy manually using TRACY_MANUAL_LIFETIME, then shut down Tracy and relaunch it after a while?

@FedyuninV
Copy link
Author

These 4 commits together allow us to not use DeferItem and avoid this infinite growth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants