diff --git a/core/smallobject_hotbox_v4.c b/core/smallobject_hotbox_v4.c index a2cf1c30..6cced59f 100644 --- a/core/smallobject_hotbox_v4.c +++ b/core/smallobject_hotbox_v4.c @@ -97,14 +97,7 @@ static small_page_v4* v4_find_page(small_class_heap_v4* h, const uint8_t* ptr, v return p; } } - prev = NULL; - for (small_page_v4* p = h->full_head; p; prev = p, p = p->next) { - if (v4_ptr_in_page(p, ptr)) { - if (loc) *loc = V4_LOC_FULL; - if (prev_out) *prev_out = prev; - return p; - } - } + // full リストは探さない(v4 C7 は partial/current だけで完結する想定) return NULL; } @@ -301,8 +294,12 @@ void small_heap_free_fast_v4(small_heap_ctx_v4* ctx, int class_idx, void* ptr) { h->current = page; page->next = NULL; } else if (loc == V4_LOC_FULL && page->freelist) { - // full → partial に戻す + // full → partial に戻す(current があっても partial 上限までは復帰) v4_unlink_from_list(h, loc, prev, page); - v4_page_push_partial(h, page); + if (h->partial_count < V4_MAX_PARTIAL_PAGES) { + v4_page_push_partial(h, page); + } else { + v4_page_push_full(h, page); // 上限超なら戻す + } } }