add allocate block function