Enable a seconary allocator support (e.g. GWP-Asan) (#737)

This commit is contained in:
Schrodinger ZHU Yifan
2025-02-05 17:03:11 +08:00
committed by GitHub
parent 32495fd42d
commit 16b96245f6
12 changed files with 290 additions and 33 deletions

View File

@@ -23,7 +23,8 @@ namespace snmalloc
int main()
{
#ifdef SNMALLOC_PASS_THROUGH
#if defined(SNMALLOC_PASS_THROUGH) || \
defined(SNMALLOC_ENABLE_GWP_ASAN_INTEGRATION)
// This test does not make sense in pass-through
return 0;
#else

View File

@@ -1,3 +1,4 @@
#include "snmalloc/mem/secondary.h"
#include "test/setup.h"
#include <iostream>
@@ -38,18 +39,26 @@ int main()
while (true)
{
auto r1 = a.alloc(object_size);
count += object_size;
i++;
// Run until we exhaust the fixed region.
// This should return null.
if (r1 == nullptr)
break;
if (!a.is_snmalloc_owned(r1))
{
a.dealloc(r1);
continue;
}
if (i == 1024)
{
i = 0;
std::cout << ".";
}
// Run until we exhaust the fixed region.
// This should return null.
if (r1 == nullptr)
break;
if (oe_base > r1)
{