Created
June 5, 2012 03:45
-
-
Save awreece/2872496 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ar_free(void* ptr) { | |
assertf(malloc_initialized, "Free called before initialization"); | |
assert_notnull(ptr); | |
slab_t* slab = ptr_to_slab(ptr); | |
assert_notnull(slab); | |
tcache_t* cache = get_tcache(); | |
// Avoid false sharing by only caching blocks from our arena. | |
if (slab->bin->arena == cache->arena || !free_to_original) { | |
tcache_free(cache, slab->bin->slab_class->index, ptr); | |
} else { | |
slab_bin_free(slab->bin, slab, ptr); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment