mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Better
This commit is contained in:
parent
5c6c378fae
commit
6753a0ad18
@ -181,7 +181,7 @@ add_library (clickhouse_new_delete STATIC Common/new_delete.cpp)
|
||||
target_link_libraries (clickhouse_new_delete PRIVATE clickhouse_common_io)
|
||||
if (TARGET ch_contrib::jemalloc)
|
||||
target_link_libraries (clickhouse_new_delete PRIVATE ch_contrib::jemalloc)
|
||||
target_link_libraries (clickhouse_common_io PRIVATE ch_contrib::jemalloc)
|
||||
target_link_libraries (clickhouse_common_io PUBLIC ch_contrib::jemalloc)
|
||||
target_link_libraries (clickhouse_storages_system PRIVATE ch_contrib::jemalloc)
|
||||
endif()
|
||||
|
||||
|
@ -94,9 +94,7 @@ void * allocNoTrack(size_t size, size_t alignment)
|
||||
if constexpr (clear_memory)
|
||||
buf = ::calloc(size, 1);
|
||||
else
|
||||
{
|
||||
buf = ::malloc(size);
|
||||
}
|
||||
|
||||
if (nullptr == buf)
|
||||
throw DB::ErrnoException(DB::ErrorCodes::CANNOT_ALLOCATE_MEMORY, "Allocator: Cannot malloc {}.", ReadableSize(size));
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include <Common/CurrentMetrics.h>
|
||||
#include <Common/filesystemHelpers.h>
|
||||
#include <Common/logger_useful.h>
|
||||
#include <Common/memory.h>
|
||||
#include <IO/UncompressedCache.h>
|
||||
#include <IO/MMappedFileCache.h>
|
||||
#include <IO/ReadHelpers.h>
|
||||
|
@ -1,14 +1,13 @@
|
||||
#include <Common/memory.h>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
/** These functions can be substituted instead of regular ones when memory tracking is needed.
|
||||
*/
|
||||
|
||||
extern "C" void * clickhouse_malloc(size_t size)
|
||||
{
|
||||
void * res = nullptr;
|
||||
res = malloc(size);
|
||||
|
||||
void * res = malloc(size);
|
||||
if (res)
|
||||
{
|
||||
AllocationTrace trace;
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <gwp_asan/guarded_pool_allocator.h>
|
||||
#include <Common/memory.h>
|
||||
|
||||
#if USE_GWP_ASAN
|
||||
#include <gwp_asan/guarded_pool_allocator.h>
|
||||
|
||||
namespace Memory
|
||||
{
|
||||
gwp_asan::GuardedPoolAllocator GuardedAlloc;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <Common/MemoryTracker.h>
|
||||
#include <Daemon/BaseDaemon.h>
|
||||
#include <Daemon/SentryWriter.h>
|
||||
#include <Common/memory.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@ -156,6 +157,19 @@ static void signalHandler(int sig, siginfo_t * info, void * context)
|
||||
const ucontext_t * signal_context = reinterpret_cast<ucontext_t *>(context);
|
||||
const StackTrace stack_trace(*signal_context);
|
||||
|
||||
const auto is_gwp_asan = [&]
|
||||
{
|
||||
auto state = ::Memory::GuardedAlloc.getAllocatorState();
|
||||
if (state->FailureType != gwp_asan::Error::UNKNOWN && state->FailureAddress != 0)
|
||||
return true;
|
||||
|
||||
auto addr = reinterpret_cast<uintptr_t>(info->si_addr);
|
||||
return addr < state->GuardedPagePoolEnd && state->GuardedPagePool <= addr;
|
||||
};
|
||||
|
||||
if (is_gwp_asan())
|
||||
std::cerr << "GWPAsan caught something!" << std::endl;
|
||||
|
||||
writeBinary(sig, out);
|
||||
writePODBinary(*info, out);
|
||||
writePODBinary(signal_context, out);
|
||||
|
Loading…
Reference in New Issue
Block a user