Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] Gripes with array
 Richard Jones [Thu, 9 Sep 2004]:
 > On Thu, Sep 09, 2004 at 09:17:25AM +0200, Jean-Christophe Filliatre wrote:
 > > 
 > > Jon Harrop writes:
 > >  > 
 > >  > 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.
 > > 
 > > In ocaml sources, the  file byterun/mlvalues.h gives all details about
 > > the  block  header structure.  There  you can  see  that,  on 32  bits
 > > architecture,  the block size  (in words)  is stored  on 22  bits. And
 > > indeed Sys.max_array_length is equal to 2^22-1.
 > > 
 > > But I must  agree with you: this is definitely too  small and we could
 > > imagine  that, when the  tag says  a block  is an  array, the  size is
 > > stored within the first (or the last) field instead.
 > 
 > I have a similar problem with the maximum size of strings.  In
 > practical terms, it limits the size of file uploads to COCANWIKI to
 > around 6 MB (ie., not very much) [not the full 16 MB because of
 > character escaping, but even 16 MB would be far too small].

You can use Bigarrays:

open Bigarray
type bigstring = (char, int8_unsigned_elt, c_layout) Array1.t

all you need is to write some blitting functions for conversions to
and from regular strings.

 > Does the tag field need to be so wide?  What does the tag mean if it
 > has different values < No_scan_tag (251)?

it's for variants (with or without arguments)

-- 
   Olivier

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners