#include "components/gwp_asan/client/lightweight_detector/malloc_shims.h"
#include <limits>
#include <optional>
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/notreached.h"
#include "base/numerics/checked_math.h"
#include "components/gwp_asan/client/lightweight_detector/random_eviction_quarantine.h"
#include "components/gwp_asan/client/sampling_state.h"
#include "partition_alloc/shim/allocator_shim.h"
namespace gwp_asan::internal::lud {
namespace {
AllocatorDispatch;
extern AllocatorDispatch g_allocator_dispatch;
SamplingState<LIGHTWEIGHTDETECTOR> sampling_state;
bool MaybeQuarantine(void* address,
std::optional<size_t> maybe_size,
void* context,
FreeFunctionKind kind) { … }
void FreeFn(void* address, void* context) { … }
void FreeDefiniteSizeFn(void* address, size_t size, void* context) { … }
void TryFreeDefaultFn(void* address, void* context) { … }
static void AlignedFreeFn(void* address, void* context) { … }
AllocatorDispatch g_allocator_dispatch = …;
}
void InstallMallocHooks(size_t max_allocation_count,
size_t max_total_size,
size_t total_size_high_water_mark,
size_t total_size_low_water_mark,
size_t eviction_chunk_size,
size_t eviction_task_interval_ms,
size_t sampling_frequency) { … }
void FinishFree(const AllocationInfo& allocation) { … }
}