add allocate method