google / tcmalloc

Apache License 2.0
4.32k stars 466 forks source link

When is memory released to system? #176

Open SrivastavaAnubhav opened 1 year ago

SrivastavaAnubhav commented 1 year ago

In gperftools/tcmalloc, if you allocated and freed a bunch of memory, it wouldn't be released to the system until a call to MallocExtension::instance()->ReleaseToSystem(bytes). I noticed that this isn't the case in google/tcmalloc (the memory appears to be released to the system after it is freed).

Is there a check in the release path for whether to release memory to the system? I'm wondering if releasing memory to the system might result in unnecessary churn if an application is going to repeatedly allocate and free the same amount of memory. Is this based on a configurable value?

Also, is this the correct forum to ask questions like this that aren't product issues, or is there something like a google group / mailing list that would be more appropriate?