Bug 699395 - Modify zone_good_size to call je_malloc_usable_size_in_advance. r=njn
authorJustin Lebar <justin.lebar@gmail.com>
Mon, 07 Nov 2011 16:32:36 -0500
changeset 79965 b23b73290e38e36ff5da26992ea6ff745ea7c697
parent 79964 34e3a0cb25a4e8337d4cdaabe7a8cf72e177e7f5
child 79966 ebb4fe2d4c83dbbc018464b66c76a7a0d65b5513
push id3226
push userjlebar@mozilla.com
push dateTue, 08 Nov 2011 02:09:06 +0000
treeherdermozilla-inbound@b23b73290e38 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs699395
milestone10.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 699395 - Modify zone_good_size to call je_malloc_usable_size_in_advance. r=njn
memory/jemalloc/jemalloc.c
--- a/memory/jemalloc/jemalloc.c
+++ b/memory/jemalloc/jemalloc.c
@@ -6873,34 +6873,17 @@ zone_destroy(malloc_zone_t *zone)
 	/* This function should never be called. */
 	assert(false);
 	return (NULL);
 }
 
 static size_t
 zone_good_size(malloc_zone_t *zone, size_t size)
 {
-	size_t ret;
-	void *p;
-
-	/*
-	 * Actually create an object of the appropriate size, then find out
-	 * how large it could have been without moving up to the next size
-	 * class.
-	 *
-	 * I sure hope this doesn't get called often.
-	 */
-	p = malloc(size);
-	if (p != NULL) {
-		ret = isalloc(p);
-		free(p);
-	} else
-		ret = size;
-
-	return (ret);
+	return je_malloc_usable_size_in_advance(size);
 }
 
 static size_t
 ozone_size(malloc_zone_t *zone, void *ptr)
 {
 	size_t ret = isalloc_validate(ptr);
 	if (ret == 0)
 		ret = szone->size(zone, ptr);