summaryrefslogtreecommitdiffstats
path: root/library/cpp/malloc/tcmalloc/malloc-info.cpp
blob: fc4603de5956fdfc73144f8f8590ba07b044713f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <library/cpp/malloc/api/malloc.h>
#include <contrib/libs/tcmalloc/tcmalloc/internal_malloc_extension.h>

using namespace NMalloc;

TMallocInfo NMalloc::MallocInfo() {
    TMallocInfo r;
    r.Name = "tcmalloc";
    return r;
}

void NMalloc::ClearCaches() {
    // not available on darwin, see internal_malloc_extension.h for details
#ifndef _darwin_
    MallocExtension_Internal_ReleaseMemoryToSystem(std::numeric_limits<size_t>::max());
#endif
}