You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I finally got our threads to call SetThreadName in tracy, and was surprised to find 400MB of memory piling up (80MB base + 4mb x 80 threads = 400). Every 40 threads created/destroy would add 4MB x 40 thread = 160mb). This is a lot for mobile apps, or apps with large numbers of threads.
Seems that each tracy_malloc call, in this case allocating a 32B or less name, then causes a rpmalloc heap/span to get created. These are never released. So I found the ThreadExitHandler (not documented), and that is required to do the rpmalloc finalize before a thread is exited.
So seems like these changes would help:
There should be some control over the size of each rpmalloc heap
SetThreadName shouldn't use tracy_malloc. App may never send any timestamps. Only create heaps if server connects and receives timestamps from a thread.
A flag to disable use of rpmalloc, and use the system or custom malloc.
Document these heaps and need for cleanup via ThreadExitHandler dtor.
The text was updated successfully, but these errors were encountered:
Looks like there's this, so that could be used to lower the memory page size. But no early call to this with static init creating threads and initing the rpmalloc with a null config.
So I finally got our threads to call SetThreadName in tracy, and was surprised to find 400MB of memory piling up (80MB base + 4mb x 80 threads = 400). Every 40 threads created/destroy would add 4MB x 40 thread = 160mb). This is a lot for mobile apps, or apps with large numbers of threads.
Seems that each tracy_malloc call, in this case allocating a 32B or less name, then causes a rpmalloc heap/span to get created. These are never released. So I found the ThreadExitHandler (not documented), and that is required to do the rpmalloc finalize before a thread is exited.
So seems like these changes would help:
The text was updated successfully, but these errors were encountered: