blob: 4cbcfacb30c393c8409ddf2b084c59f437852ebd (
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
|
#pragma once
#include <util/memory/segmented_string_pool.h>
struct MemoryContextData;
typedef struct MemoryContextData *MemoryContext;
namespace NYql {
class TArenaMemoryContext {
public:
TArenaMemoryContext();
~TArenaMemoryContext();
static segmented_string_pool& GetCurrentPool() {
return Current->Pool;
}
void Acquire();
void Release();
private:
segmented_string_pool Pool;
MemoryContext PrevContext = nullptr;
MemoryContext MyContext = nullptr;
static __thread TArenaMemoryContext* Current;
TArenaMemoryContext* Prev = nullptr;
};
}
|