This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug malloc/1128] Malloc not trimming filled-up sbrk space causes unnecessary system call overhead


https://sourceware.org/bugzilla/show_bug.cgi?id=1128

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neleai at seznam dot cz

--- Comment #8 from Ondrej Bilka <neleai at seznam dot cz> ---
Does following patch fixes performance for you? I want to be sure that problem
was in sbrk but not in something else.

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 2938234..ab6d46f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2716,6 +2716,10 @@ static int systrim(size_t pad, mstate av)
   char* current_brk;     /* address returned by pre-check sbrk call */
   char* new_brk;         /* address returned by post-check sbrk call */
   size_t pagesz;
+  static int give_up;
+
+  if (give_up)
+    return 0;

   pagesz = GLRO(dl_pagesize);
   top_size = chunksize(av->top);
@@ -2762,7 +2766,8 @@ static int systrim(size_t pad, mstate av)
          return 1;
        }
       }
-    }
+    } else
+      give_up = 1;
   }
   return 0;
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]