handle zero allocation length