alloc all memory needed