julia> v = Vector{Char}(undef, typemax(Int))
ERROR: invalid Array size
julia> v = Vector{Char}(undef, typemax(UInt32))
4294967295-element Vector{Char}:
...
julia> v = Vector{Char}(undef, 16typemax(UInt32))
ERROR: OutOfMemoryError() # I have 64Gb
ERROR: invalid Array size
is generated by
https://github.com/JuliaLang/julia/blob/master/src/array.c#L107
while the actual check jl_array_validate_dims is done in
https://github.com/JuliaLang/julia/blob/master/src/array.c#L79-L96
and that error is from
wideint_t prod = (wideint_t)elsz * (wideint_t)_nel;
if (prod >= (wideint_t) MAXINTVAL)
return 2;