English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: Can max_array_length be enlarged?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-05-22 (20:16)
From: Damien Doligez <Damien.Doligez@i...>
Subject: Re: Can max_array_length be enlarged?
>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