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

@@ -76,12 +76,16 @@ namespace test
size_t rand = (size_t)r.next();
size_t oid = rand & (((size_t)1 << count_log) - 1);
size_t* external_ptr = objects[oid];
if (!alloc.is_snmalloc_owned(external_ptr))
continue;
size_t size = *external_ptr;
size_t offset = (size >> 4) * (rand & 15);
void* interior_ptr = pointer_offset(external_ptr, offset);
void* calced_external = alloc.external_pointer(interior_ptr);
if (calced_external != external_ptr)
{
abort();
}
}
}