dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] gc.c: don't bother freeing unused pages
Date: Mon, 30 Jul 2018 08:57:24 +0000	[thread overview]
Message-ID: <20180730085724.29644-1-e@80x24.org> (raw)

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


                 reply	other threads:[~2018-07-30  8:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180730085724.29644-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).