]> git.saurik.com Git - redis.git/blobdiff - deps/jemalloc/src/chunk.c
Globals protection global() function modified for speed and correctness.
[redis.git] / deps / jemalloc / src / chunk.c
index 301519e8042fb350448d882753490a790a32aaf3..d190c6f49b37482f2b00deb0b5f5b0abca043976 100644 (file)
@@ -70,7 +70,7 @@ RETURN:
 #ifdef JEMALLOC_IVSALLOC
        if (base == false && ret != NULL) {
                if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) {
-                       chunk_dealloc(ret, size);
+                       chunk_dealloc(ret, size, true);
                        return (NULL);
                }
        }
@@ -108,7 +108,7 @@ RETURN:
 }
 
 void
-chunk_dealloc(void *chunk, size_t size)
+chunk_dealloc(void *chunk, size_t size, bool unmap)
 {
 
        assert(chunk != NULL);
@@ -125,15 +125,17 @@ chunk_dealloc(void *chunk, size_t size)
        malloc_mutex_unlock(&chunks_mtx);
 #endif
 
+       if (unmap) {
 #ifdef JEMALLOC_SWAP
-       if (swap_enabled && chunk_dealloc_swap(chunk, size) == false)
-               return;
+               if (swap_enabled && chunk_dealloc_swap(chunk, size) == false)
+                       return;
 #endif
 #ifdef JEMALLOC_DSS
-       if (chunk_dealloc_dss(chunk, size) == false)
-               return;
+               if (chunk_dealloc_dss(chunk, size) == false)
+                       return;
 #endif
-       chunk_dealloc_mmap(chunk, size);
+               chunk_dealloc_mmap(chunk, size);
+       }
 }
 
 bool