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
tcmalloc::MallocExtension::ReleaseMemoryToSystem should ideally be improved as follows:
It should return the number of bytes actually released to the system. Currently it just ignores the return value of MallocExtension_Internal_ReleaseMemoryToSystem:
There should be a parameter to avoid invoking the logic based on extra_bytes_released, and simply release the requested number of bytes.
// ReleaseMemoryToSystem() might release more than the requested bytes because
// the page heap releases at the span granularity, and spans are of wildly
// different sizes. This keeps track of the extra bytes bytes released so
// that the app can periodically call ReleaseMemoryToSystem() to release
// memory at a constant rate.
ABSL_CONST_INIT static size_t extra_bytes_released;
absl::base_internal::SpinLockHolder rh(&release_lock);
absl::base_internal::SpinLockHolder h(&pageheap_lock);
if (num_bytes <= extra_bytes_released) {
// We released too much on a prior call, so don't release any
// more this time.
extra_bytes_released = extra_bytes_released - num_bytes;
num_bytes = 0;
} else {
num_bytes = num_bytes - extra_bytes_released;
}
The text was updated successfully, but these errors were encountered:
tcmalloc::MallocExtension::ReleaseMemoryToSystem should ideally be improved as follows:
The text was updated successfully, but these errors were encountered: