void * malloc(size_t size) { if (size <= SMALL_BLOCK) { return (void *) small_malloc(size); } if (size >= BIG_BLOCK) { return (void *) big_malloc(size); } return (void *) medium_malloc(size); }
void *malloc(size_t size) { void *ptr; if (size <= TINY_N) ptr = tiny_malloc(size); else if (size <= SMALL_N) ptr = small_malloc(size); else ptr = large_malloc(size); return (ptr); }
void * malloc(unsigned int size) { if (!malloc_initialized) malloc_init(); if (size == 0) return 0; /* so says ANSI */ /* use the special allocator for small sizes */ if (size <= 56) return small_malloc(size); /* use the standard free list for large sizes */ return big_malloc(size); }
void *malloc(size_t size) { static char flag = 0; if (size <= 0) return (NULL); if (!flag) { g_pool.tiny_m = NULL; g_pool.small_m = NULL; g_pool.large_m = NULL; flag = 1; } if (size <= TINY_M) return (tiny_malloc(size)); else if (size <= SMALL_M) return (small_malloc(size)); else return (large_malloc(size)); return (NULL); }