From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D9CA01F597 for ; Mon, 30 Jul 2018 08:57:24 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] gc.c: don't bother freeing unused pages Date: Mon, 30 Jul 2018 08:57:24 +0000 Message-Id: <20180730085724.29644-1-e@80x24.org> List-Id: While glibc malloc can effectively use the "extra" memory allocated internally by posix_memalign, it is not good at reusing the result of posix_memalign once freed. cf. https://sourceware.org/bugzilla/show_bug.cgi?id=14581 --- gc.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/gc.c b/gc.c index ba1bbbfe08..e2c3c6f893 100644 --- a/gc.c +++ b/gc.c @@ -1489,30 +1489,6 @@ heap_page_free(rb_objspace_t *objspace, struct heap_page *page) free(page); } -static void -heap_pages_free_unused_pages(rb_objspace_t *objspace) -{ - size_t i, j; - - if (!list_empty(&heap_tomb->pages)) { - for (i = j = 1; j < heap_allocated_pages; i++) { - struct heap_page *page = heap_pages_sorted[i]; - - if (page->flags.in_tomb && page->free_slots == page->total_slots) { - heap_unlink_page(objspace, heap_tomb, page); - heap_page_free(objspace, page); - } - else { - if (i != j) { - heap_pages_sorted[j] = page; - } - j++; - } - } - GC_ASSERT(j == heap_allocated_pages); - } -} - static struct heap_page * heap_page_allocate(rb_objspace_t *objspace) { @@ -3666,7 +3642,6 @@ gc_sweep_finish(rb_objspace_t *objspace) gc_report(1, objspace, "gc_sweep_finish\n"); gc_prof_set_heap_info(objspace); - heap_pages_free_unused_pages(objspace); /* if heap_pages has unused pages, then assign them to increment */ if (heap_allocatable_pages < heap_tomb->total_pages) { -- EW