Max array length in OCaml

What’s the max array length in OCaml.

You can check it by:

# Sys.max_array_length;;

On 64-bit machine:

# Sys.max_array_length;;
- : int = 18014398509481983

On a 32-bit machne:

# Sys.max_array_length;;
- : int = 4194303

This is due to the memory representation of arrays. 64 Bit machines are better here.

And AFAIK, OCaml was developed with 64 Bit machines in mind;
the developers of OCaml thought, they will spread much faster.


Leave a Reply

Your email address will not be published. Required fields are marked *