[ANN] ArrayAllocators.jl: Integrating calloc and aligned memory into Array construction

I apologize beforehand if my question is very naive. I’m one of those people who use Julia because they really don’t want to worry about internals.

I was told in another thread that Julia arrays are not guaranteed to be contiguous in memory. In particular - as a consequence - if I create a Julia array e.g. Vector{UInt8}(undef, 8*N) and then extract the pointer, then create a new Vector{Float64} that points to the same memory, then this is unsafe. Something like this:

_C = zeros(UInt8, 100 * sizeof(Float64))
ptr = Base.unsafe_convert(Ptr{Float64}, _C)
C = Base.unsafe_wrap(Array, ptr, 100)

(note that I’m proposing to remember _C so that the GC doesn’t release the memory.)

Now, if I were to use your Vector{UInt8}(calloc, 8*N) instead, i.e.,

_C = Vector{UInt8}(calloc, 100 * sizeof(Float64))

is it guaranteed that the block of memory to which this vector points is contiguous? I.e. the procedure proposed above would be safe?