blob: 6c2ae00722c66fe414d6b0729febb5bc8a2da087 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespamalloc/malloc/malloc.h>
#include <vespamalloc/malloc/memorywatcher.h>
#include <vespamalloc/malloc/memblock.h>
#include <vespamalloc/malloc/stat.h>
#include <vespamalloc/malloc/threadpool.hpp>
namespace vespamalloc {
typedef ThreadListT<MemBlock, NoStat> ThreadList;
typedef MemoryWatcher<MemBlock, ThreadList> Allocator;
static char _Gmem[sizeof(Allocator)];
static Allocator *_GmemP = nullptr;
static Allocator * createAllocator()
{
if (_GmemP == nullptr) {
_GmemP = (Allocator *)1;
_GmemP = new (_Gmem) Allocator(-1, 0x7fffffffffffffffl);
}
return _GmemP;
}
template <>
void MemBlock::
dumpInfo(size_t level)
{
_GmemP->info(_G_logFile, level);
}
}
extern "C" {
int is_vespamalloc() __attribute__((visibility ("default")));
int is_vespamalloc() { return 1; }
}
#include <vespamalloc/malloc/overload.h>
|