summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-10-16 19:05:02 (GMT)
committerDaniel Micay <danielmicay@gmail.com>2014-10-16 19:39:59 (GMT)
commita9ea10d27c320926cab2e59c66ebcd25c49df24c (patch)
treef96d64312e1615976ec3a0eed3d15e3def95c125
parent9673983443a0782d975fbcb5d8457cfd411b8b56 (diff)
downloadjemalloc-a9ea10d27c320926cab2e59c66ebcd25c49df24c.zip
jemalloc-a9ea10d27c320926cab2e59c66ebcd25c49df24c.tar.gz
jemalloc-a9ea10d27c320926cab2e59c66ebcd25c49df24c.tar.bz2
use sized deallocation internally for ralloc
The size of the source allocation is known at this point, so reading the chunk header can be avoided for the small size class fast path. This is not very useful right now, but it provides a significant performance boost with an alternate ralloc entry point taking the old size.
-rw-r--r--src/arena.c2
-rw-r--r--src/huge.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/arena.c b/src/arena.c
index 586e3c7..d7377ae 100644
--- a/src/arena.c
+++ b/src/arena.c
@@ -2220,7 +2220,7 @@ arena_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, size_t size,
copysize = (size < oldsize) ? size : oldsize;
JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, copysize);
memcpy(ret, ptr, copysize);
- iqalloc(tsd, ptr, try_tcache_dalloc);
+ isqalloc(tsd, ptr, oldsize, try_tcache_dalloc);
return (ret);
}
diff --git a/src/huge.c b/src/huge.c
index 1734ff6..826464c 100644
--- a/src/huge.c
+++ b/src/huge.c
@@ -328,7 +328,7 @@ huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, size_t size,
*/
copysize = (size < oldsize) ? size : oldsize;
memcpy(ret, ptr, copysize);
- iqalloc(tsd, ptr, try_tcache_dalloc);
+ isqalloc(tsd, ptr, oldsize, try_tcache_dalloc);
return (ret);
}