SuperMalloc icon indicating copy to clipboard operation
SuperMalloc copied to clipboard

Need to test error paths for when mmap() fails

Open kuszmaul opened this issue 10 years ago • 0 comments

We put in some nontrivial code. Need to make sure that all the error paths actually work.

Here's the call chain. We want to make sure that all these functions, at all their call sites, actually call their error-handling code.

mmap_size called by chunk_create_slow (returns 0 on error) mmap_chunk_aligned_block (returns 0)

chunk_create_slow called by mmap_chunk_aligned_block (returns 0)

mmap_chunk_aligned_block called by get_power_of_two_chunks (returns 0) large_malloc (returns 0) initialize_malloc (aborts on a problem) small_malloc (returns 0)

get_power_of_two_chunks called by huge__malloc (returns null)

large_malloc cached_malloc (returns NULL)

initialize_malloc (aborts on problem)

small_malloc called by cached_malloc (returns NULL)

huge_malloc called by malloc (returns NULL) aligned_malloc_internal (returns NULL)

cached_malloc malloc (returns NULL) aligned_malloc_internal (returns NULL)

aligned_malloc_internal aligned_malloc (returns NULL) posix_memalign (some fancy footwork on the error to return the right value)

kuszmaul avatar Jun 08 '15 02:06 kuszmaul