Add some comments

This commit is contained in:
Antonio Andelic 2024-07-18 13:40:03 +02:00
parent 9ec1fd1ab7
commit 05c7dc582a
2 changed files with 9 additions and 0 deletions

View File

@ -41,6 +41,9 @@ T getJemallocValue(const char * name)
return value;
}
/// Each mallctl call consists of string name lookup which can be expensive.
/// This can be avoided by translating name to "Management Information Base" (MIB)
/// and using it in mallctlbymib calls
template <typename T>
struct JemallocMibCache
{

View File

@ -8,6 +8,12 @@ namespace DB
{
#if USE_JEMALLOC
/// Correct MemoryTracker based on stats.resident read from jemalloc.
/// This requires jemalloc built with --enable-stats which we use.
/// The worker spawns a background thread which moves the jemalloc epoch (updates internal stats),
/// and fetches the current stats.resident whose value is sent to global MemoryTracker.
/// Additionally, if the current memory usage is higher than global hard limit,
/// jemalloc's dirty pages are forcefully purged.
class MemoryWorker
{
public: