google / google/tcmalloc

ProcessBackgroundActions and max cache sizes tuning questions

Open
#260 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5.3k
Forks
570
Avg merge
23h 43m
Merged PRs (30d)
172

Description

Hi,

1. is the thread calling tcmalloc::MallocExtension::ProcessBackgroundActions()
must be detached, or joinable?

If joinable is ok, can you do the following at program teardown:
```
tcmalloc::MallocExtension::SetBackgroundProcessActionsEnabled(false);
bkgThread.join();
```

by quickly scanning MallocExtension_Internal_ProcessBackgroundActions(), I have concluded that it was doing more than just release memory...

is this correct?
because I am planning keep BackgroundReleaseRate to its zero default value to avoid generating madvise() system calls...

2. tcmalloc::MallocExtension::SetBackgroundProcessSleepInterval()

default value is 1 second.

What is the reasonable range for that parameter?

1 second - 1 hour ?

What are the tradeoffs of a long interval vs short interval?

I had in mind 30 seconds for my app.

Does the background housekeeping tasks induce lock contention to the threads using the allocator?

3. Which stats to look at to determine that increasing the max cache sizes could have a positive effect?

overflows / underflows ratio?
anything else?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.