diff options
Diffstat (limited to 'debian/patches/no-brk-caching.diff')
-rw-r--r-- | debian/patches/no-brk-caching.diff | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches/no-brk-caching.diff b/debian/patches/no-brk-caching.diff new file mode 100644 index 0000000..dc4ba85 --- /dev/null +++ b/debian/patches/no-brk-caching.diff @@ -0,0 +1,47 @@ +# DP: Don't cache the value of brk between sbrk calls. + +--- a/lib/malloc/malloc.c ++++ b/lib/malloc/malloc.c +@@ -227,8 +227,6 @@ + static int pagebucket; /* bucket for requests a page in size */ + static int maxbuck; /* highest bucket receiving allocation request. */ + +-static char *memtop; /* top of heap */ +- + static const unsigned long binsizes[NBUCKETS] = { + 8UL, 16UL, 32UL, 64UL, 128UL, 256UL, 512UL, 1024UL, 2048UL, 4096UL, + 8192UL, 16384UL, 32768UL, 65536UL, 131072UL, 262144UL, 524288UL, +@@ -538,7 +536,6 @@ + siz = binsize (nu); + /* Should check for errors here, I guess. */ + sbrk (-siz); +- memtop -= siz; + + #ifdef MALLOC_STATS + _mstats.nsbrk++; +@@ -633,8 +630,6 @@ + if ((long)mp == -1) + goto morecore_done; + +- memtop += sbrk_amt; +- + /* shouldn't happen, but just in case -- require 8-byte alignment */ + if ((long)mp & MALIGN_MASK) + { +@@ -684,7 +679,7 @@ + Some of this partial page will be wasted space, but we'll use as + much as we can. Once we figure out how much to advance the break + pointer, go ahead and do it. */ +- memtop = curbrk = sbrk (0); ++ curbrk = sbrk (0); + sbrk_needed = pagesz - ((long)curbrk & (pagesz - 1)); /* sbrk(0) % pagesz */ + if (sbrk_needed < 0) + sbrk_needed += pagesz; +@@ -699,7 +694,6 @@ + curbrk = sbrk (sbrk_needed); + if ((long)curbrk == -1) + return -1; +- memtop += sbrk_needed; + + /* Take the memory which would otherwise be wasted and populate the most + popular bin (2 == 32 bytes) with it. Add whatever we need to curbrk |