malloc for threads handled but not optimized