-
Notifications
You must be signed in to change notification settings - Fork 5.3k
memory: switch to the latest tcmalloc for x86_64 builds #13251
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
Changes from all commits
87741cf
c5854c5
69cdb1a
df9aa9d
f14a4d3
c1485cc
a01a91c
1cc9937
0e24124
956e914
cd1d298
f1c5796
b8c0bc1
8dddc10
0753f9e
1579935
a7480b4
7f01a58
a6d4c42
abc9d8e
5c75f1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,52 @@ | |
|
|
||
| #include "common/common/logger.h" | ||
|
|
||
| #ifdef TCMALLOC | ||
| #if defined(TCMALLOC) | ||
|
|
||
| #include "tcmalloc/malloc_extension.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Memory { | ||
|
|
||
| uint64_t Stats::totalCurrentlyAllocated() { | ||
| return tcmalloc::MallocExtension::GetNumericProperty("generic.current_allocated_bytes") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe for deterministic memory checks we can just use generic.current_allocated_bytes and not include tcmalloc.cpu_free? We can make 2 APIs if that helps. I'm also confused by the github UI; it is not showing me the prior impl of this method.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part (from
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Right, my bad. It shouldn't be included. I'll drop it. Though after the last merge all tests passed for a6d4c42. But the version without tcmalloc.cpu_free passes the release tests too on my local host. Let's see...
The old version is still there, just wrapped in |
||
| .value_or(0); | ||
| } | ||
|
|
||
| uint64_t Stats::totalCurrentlyReserved() { | ||
| // In Google's tcmalloc the semantics of generic.heap_size has | ||
| // changed: it doesn't include unmapped bytes. | ||
| return tcmalloc::MallocExtension::GetNumericProperty("generic.heap_size").value_or(0) + | ||
| tcmalloc::MallocExtension::GetNumericProperty("tcmalloc.pageheap_unmapped_bytes") | ||
| .value_or(0); | ||
| } | ||
|
|
||
| uint64_t Stats::totalThreadCacheBytes() { | ||
| return tcmalloc::MallocExtension::GetNumericProperty("tcmalloc.current_total_thread_cache_bytes") | ||
| .value_or(0); | ||
| } | ||
|
|
||
| uint64_t Stats::totalPageHeapFree() { | ||
| return tcmalloc::MallocExtension::GetNumericProperty("tcmalloc.pageheap_free_bytes").value_or(0); | ||
| } | ||
|
|
||
| uint64_t Stats::totalPageHeapUnmapped() { | ||
| return tcmalloc::MallocExtension::GetNumericProperty("tcmalloc.pageheap_unmapped_bytes") | ||
| .value_or(0); | ||
| } | ||
|
|
||
| uint64_t Stats::totalPhysicalBytes() { | ||
| return tcmalloc::MallocExtension::GetProperties()["generic.physical_memory_used"].value; | ||
| } | ||
|
|
||
| void Stats::dumpStatsToLog() { | ||
| ENVOY_LOG_MISC(debug, "TCMalloc stats:\n{}", tcmalloc::MallocExtension::GetStats()); | ||
| } | ||
|
|
||
| } // namespace Memory | ||
| } // namespace Envoy | ||
|
|
||
| #elif defined(GPERFTOOLS_TCMALLOC) | ||
|
|
||
| #include "gperftools/malloc_extension.h" | ||
|
|
||
|
|
@@ -74,4 +119,4 @@ void Stats::dumpStatsToLog() {} | |
| } // namespace Memory | ||
| } // namespace Envoy | ||
|
|
||
| #endif // #ifdef TCMALLOC | ||
| #endif // #if defined(TCMALLOC) | ||
Uh oh!
There was an error while loading. Please reload this page.