_DEFAULT_ALLOC_H_ #include <> #include <stdlib.h> #include <iostream> * *oom_realloc( * (* * *p = (NULL == p = deallocate( * *reallocate( * *p = (NULL == p = typedef (* handler old_handler = _malloc_alloc_oom_handler = }; (*malloc_alloc::_malloc_alloc_oom_handler)() = * (* * my_malloc_handle = res = (_malloc_alloc_oom_handler == std::cerr<<<<std::endl, exit(- *malloc_alloc::oom_realloc( * (* * my_malloc_handle = res = (_malloc_alloc_oom_handler == std::cerr << << std::endl, exit(- {_ALIGN = {_MAX_BYTES = {_FREE_LIST_NUM = _MAX_BYTES / union obj * * obj * * * (bytes + _ALIGN - ) & ~(_ALIGN - round_up(bytes) / _ALIGN - * *chunk_alloc(size_t size, & * deallocate( * *reallocate( * }; * default_alloc::free_start = * default_alloc::free_end = size_t default_alloc::heap_size = default_alloc::obj * default_alloc::free_list[_FREE_LIST_NUM] = { , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , * obj * obj ** (n > list_temp = free_list + ( == * *r = (obj * res = * *list_temp = res-> default_alloc::deallocate( * obj **list_temp = free_list + obj *res = (obj * res->next = * *list_temp = *default_alloc::reallocate( * * objs = *chunks = obj **list_temp = free_list + obj *res = (obj * obj *next_obj = *list_temp = (obj *)(chunks + ( i = ; ; ++ (i == objs - next_obj->next = next_obj->next = next_obj + next_obj = next_obj-> *default_alloc::chunk_alloc(size_t size, & * size_t total_bytes = size * size_t bytes_left = free_end - (bytes_left >= res = free_start += (bytes_left >= nobjs = bytes_left / res = free_start += nobjs * size_t bytes_to_get = * total_bytes + round_up(heap_size >> (bytes_left > obj **list_temp = free_list + ((obj *)(free_start))->next = * *list_temp = (obj * free_start = ( * ( == obj ** ( i = size; i <= _MAX_BYTES; i += list_temp = free_list + ( != * free_start = ( *)* *list_temp = (*list_temp)-> free_end = free_start + free_end = free_start = ( * heap_size += free_end = free_start + }