aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-02-27 11:45:06 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-02-27 11:45:06 +0100
commit5ba7a73f97fe6880dc5328807a1cb9353e77b863 (patch)
treeeecedfad2887dc717d1771ed3e7a9bc8b7ba1ff7 /README.md
parentfb19b1c35f6ec52c075b214d2f0416900a7c1bbe (diff)
downloadmalloc-5ba7a73f97fe6880dc5328807a1cb9353e77b863.tar.gz
malloc-5ba7a73f97fe6880dc5328807a1cb9353e77b863.zip
Implement free and add testing notes to README
free now locates the chunk matching the pointer, marks it as free for TINY/SMALL zones, and munmaps LARGE allocations. Document why ASan is incompatible and list alternatives.
Diffstat (limited to 'README.md')
-rw-r--r--README.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/README.md b/README.md
index ef21ed7..971bdf5 100644
--- a/README.md
+++ b/README.md
@@ -53,3 +53,19 @@ are allocated on demand when the current one is full. LARGE allocations each
get their own `mmap` region and are released individually via `munmap`.
All returned pointers are 16-byte aligned.
+
+## Testing
+
+AddressSanitizer (ASan) cannot be used to test this allocator. ASan intercepts
+`malloc`/`free` itself and expects specific allocator metadata (redzones,
+quarantine zones) that a custom allocator does not provide. The two
+implementations would conflict. Since allocations go through `mmap`, they also
+bypass ASan's shadow memory tracking entirely.
+
+Alternatives for catching bugs:
+- **Valgrind** — operates at the binary level without replacing `malloc`, so it
+ can detect issues in the allocator's own internal logic.
+- **Custom tests** — targeted checks for write-after-free, double free, boundary
+ writes, and stress scenarios.
+- **`show_alloc_mem()`** — inspect zone and chunk state visually after
+ operations.