mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
fdd2db4ace
* move check for denied allocations * remove include * make hardening softer
20 lines
602 B
C++
20 lines
602 B
C++
#pragma once
|
|
|
|
#include <base/types.h>
|
|
|
|
/// Convenience methods, that use current thread's memory_tracker if it is available.
|
|
struct CurrentMemoryTracker
|
|
{
|
|
/// Call the following functions before calling of corresponding operations with memory allocators.
|
|
static void alloc(Int64 size);
|
|
static void allocNoThrow(Int64 size);
|
|
static void realloc(Int64 old_size, Int64 new_size);
|
|
|
|
/// This function should be called after memory deallocation.
|
|
static void free(Int64 size);
|
|
static void check();
|
|
|
|
private:
|
|
static void allocImpl(Int64 size, bool throw_if_memory_exceeded);
|
|
};
|