Re: Can max_array_length be enlarged?

From: Damien Doligez (Damien.Doligez@inria.fr)
Date: Mon May 22 2000 - 20:33:55 MET DST

  • Next message: Max Skaller: "Re: reference initialization"

    >From: "Dennis (Gang) Chen" <Dennis.G.Chen@motorola.com>

    >In ocaml, the max length of array is determined by the predefined constant
    >max_array_length. Is it possible to build an array with length
    >longer than this? I noticed that this constant is defined in source
    >code sys.ml by:
    >
    >let max_array_length = (1 lsl (word_size - 10)) - 1;;
    >
    >Is it safe to modify this code to set a bigger value for max_array_length?

    No. The formula really gives the maximum array size that can be
    supported by the runtime and garbage collector (about 4M fields, or
    16MB on a 32-bit machine). Maybe you should have a look a the
    "bigarray" library, which was designed for huge arrays (of numbers).
    Or you could get a 64-bit machine, they can handle more memory than
    32-bitters anyway.

    -- Damien



    This archive was generated by hypermail 2b29 : Mon May 22 2000 - 22:18:52 MET DST