Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Gripes with array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-09 (02:14)
From: Jon Harrop <jon@j...>
Subject: [Caml-list] Gripes with array

I'm increasingly finding the outrageously finite size limit of arrays to be a 
pain. In particular, I'm peeved that the size limit is itself a function of 
the type which, therefore, makes writing polymorphic functions over arrays 
nay-on impossible (e.g. to make an array of maximum-sized arrays). Can 
anything be done about this? Am I right in thinking that the maximum 
non-float array size on a 64-bit machine is 18,014,398,509,481,983?

Also, can Array.init be made to fill the elements only once? This would make 
quite a few things twice as fast (Indeed, I'd always assumed that this was 
the point of having Array.init, having read some of Skaller's previous 
ramblings ;-). Array.copy could then be written more succinctly and 
efficiently in terms of Array.init as:

let copy a = init (length a) (fun i -> a.(i))

Does anyone have any pointers to information about the origin of the size 
limit for arrays? I assume it is something to do with the garbage collector 
using a fixed-size tag instead of a variable-size one but I'd be interested 
in the details.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: