implemented allocate api