Fix mid free routing and relax mid W_MAX
This commit is contained in:
@ -199,16 +199,24 @@ ptr_classification_t classify_ptr(void* ptr) {
|
||||
uint8_t header = *((uint8_t*)ptr - 1);
|
||||
uint8_t magic = header & 0xF0;
|
||||
|
||||
// Fast path: Tiny allocation (magic = 0xa0)
|
||||
// Fast path: Tiny allocation (magic = 0xa0) — guarded by Superslab registry
|
||||
if (magic == HEADER_MAGIC) { // HEADER_MAGIC = 0xa0
|
||||
int class_idx = header & HEADER_CLASS_MASK;
|
||||
if (class_idx >= 0 && class_idx < TINY_NUM_CLASSES) {
|
||||
result.kind = PTR_KIND_TINY_HEADER;
|
||||
result.class_idx = class_idx;
|
||||
SuperSlab* ss = hak_super_lookup(ptr);
|
||||
if (ss && ss->magic == SUPERSLAB_MAGIC) {
|
||||
result.kind = PTR_KIND_TINY_HEADER;
|
||||
result.class_idx = class_idx;
|
||||
result.ss = ss;
|
||||
#if !HAKMEM_BUILD_RELEASE
|
||||
g_classify_header_hit++;
|
||||
g_classify_header_hit++;
|
||||
#endif
|
||||
return result;
|
||||
return result;
|
||||
} else {
|
||||
// Superslab未登録 → hakmem外。Tiny扱いしない。
|
||||
result.kind = PTR_KIND_UNKNOWN;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user