-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Disabling tcmalloc cache #1466
Comments
Hi. There are no ways to disable cache fully, but there are some knobs that could be used. Look at TCMALLOC_SMALL_BUT_SLOW (this is preprocessor define). You can also tweak down size of cache. And you can also enable aggressive decommit. Do note however, that based on my experience (but without knowing exactly what is your use-case; so I might be totally wrong), I am guessing you might be fighting symptoms rather than root case. My suspicion is you're facing some sort of memory fragmentation case. And if so then attacking it more directly (rather then potentially crippling malloc performance for your entire program) might be better direction. |
Hi @alk. My use case is to minimise the memory utilisation to as low as possible, doesn't matter the performance. If possible, can you guide me with how to tweak down size of cache. I tried
but doesn't helped. Cache is still there. I tried TCMALLOC_SMALL_BUT_SLOW also, but didn't saw improvement as such. |
Well, consider some other malloc implementation then, if you don't care about performance at all. Ours is trying to balance performance and fragmentation matters with more emphasis on performance. Aggressive decommit is available via --enable-aggressive-decommit-by-default configure option. As for cache size, that call above should get you to minimum size. The code clips value to kMinThreadCacheSize which appears to be set to 2 megs. If none of that helps, then this is as much as we can offer you (but do listen to my words, every single indication so far that you're royally misunderstanding the issue you're dealing with) |
Ah, also you may find MallocExtension::MarkThreadIdle potentially useful w.r.t. limiting cache usage (but it will only help in some cases; do check source code if in doubt) |
Thanks @alk |
No. Not possible by design. And truly if few megs is so big deal for you, then perhaps consider doing something custom. |
Thanks @alk . Yeah we had some issue with these few megs also. Just want to confirm if it is possible. |
Hi community, is there is some way to disable the tcmalloc cache totally. We are working on minimising the memory usage of our system.
The text was updated successfully, but these errors were encountered: