caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Possible bug in DynArray module from ExtLib
@ 2007-03-31 18:15 Dário Abdulrehman
  2007-03-31 20:34 ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Dário Abdulrehman @ 2007-03-31 18:15 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

The first of the following functions causes a "Fatal error: exception
Out_of_memory", while the second works fine.
This error seems to occur when creating large arrays with more than 2
million and something entries.
Anyone noticed this error?

Thanks.

  let test_dynarray1 () =
    let a = DynArray.create () in
    for i = 1 to 2817131 do
      DynArray.add a i
    done

  let test_dynarray2 () =
    let a = DynArray.make 2817131 in
    for i = 1 to 2817131 do
      DynArray.add a i
    done


-- 
Dário Abdulrehman

[-- Attachment #2: Type: text/html, Size: 760 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Possible bug in DynArray module from ExtLib
  2007-03-31 18:15 [Caml-list] Possible bug in DynArray module from ExtLib Dário Abdulrehman
@ 2007-03-31 20:34 ` Florian Weimer
  2007-03-31 20:37   ` Dário Abdulrehman
  2007-04-03 22:40   ` ls-ocaml-developer-2006
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Weimer @ 2007-03-31 20:34 UTC (permalink / raw)
  To: Dário Abdulrehman; +Cc: caml-list

* Dário Abdulrehman:

> The first of the following functions causes a "Fatal error: exception
> Out_of_memory", while the second works fine.
> This error seems to occur when creating large arrays with more than 2
> million and something entries.

The exponential resizer probably exceeds Ocaml's array length limit,
while direct creation does not.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Possible bug in DynArray module from ExtLib
  2007-03-31 20:34 ` Florian Weimer
@ 2007-03-31 20:37   ` Dário Abdulrehman
  2007-04-03 22:40   ` ls-ocaml-developer-2006
  1 sibling, 0 replies; 5+ messages in thread
From: Dário Abdulrehman @ 2007-03-31 20:37 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

I took a look at the DynArray implementation and it seems to be that.

On 3/31/07, Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * Dário Abdulrehman:
>
> > The first of the following functions causes a "Fatal error: exception
> > Out_of_memory", while the second works fine.
> > This error seems to occur when creating large arrays with more than 2
> > million and something entries.
>
> The exponential resizer probably exceeds Ocaml's array length limit,
> while direct creation does not.
>



-- 
Dário Abdulrehman

[-- Attachment #2: Type: text/html, Size: 848 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Possible bug in DynArray module from ExtLib
  2007-03-31 20:34 ` Florian Weimer
  2007-03-31 20:37   ` Dário Abdulrehman
@ 2007-04-03 22:40   ` ls-ocaml-developer-2006
  2007-04-04  1:35     ` skaller
  1 sibling, 1 reply; 5+ messages in thread
From: ls-ocaml-developer-2006 @ 2007-04-03 22:40 UTC (permalink / raw)
  To: caml-list


Florian Weimer <fw@deneb.enyo.de> writes:

> * Dário Abdulrehman:
>
>> The first of the following functions causes a "Fatal error: exception
>> Out_of_memory", while the second works fine.
>> This error seems to occur when creating large arrays with more than 2
>> million and something entries.
>
> The exponential resizer probably exceeds Ocaml's array length limit,
> while direct creation does not.

So a smarter resizer would be required: One which compares with the
array length limit and satisfies the request with that if necessary
and possible.

Regards -- Markus


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Possible bug in DynArray module from ExtLib
  2007-04-03 22:40   ` ls-ocaml-developer-2006
@ 2007-04-04  1:35     ` skaller
  0 siblings, 0 replies; 5+ messages in thread
From: skaller @ 2007-04-04  1:35 UTC (permalink / raw)
  To: ls-ocaml-developer-2006; +Cc: caml-list, Nicolas Cannasse

On Wed, 2007-04-04 at 00:40 +0200,
ls-ocaml-developer-2006@m-e-leypold.de wrote:

> > The exponential resizer probably exceeds Ocaml's array length limit,
> > while direct creation does not.
> 
> So a smarter resizer would be required: One which compares with the
> array length limit and satisfies the request with that if necessary
> and possible.

AFAIK DynArray has a resizer following my suggestion: you can
supply an arbitrary resizer function on construction, presumably with a
defaulted labelled argument (its the standard
library Buffer that doesn't have one).
I'm not sure, it's a while since I looked at ExtLib .. CC'd to
Nicolas who owns the library.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-04  1:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-31 18:15 [Caml-list] Possible bug in DynArray module from ExtLib Dário Abdulrehman
2007-03-31 20:34 ` Florian Weimer
2007-03-31 20:37   ` Dário Abdulrehman
2007-04-03 22:40   ` ls-ocaml-developer-2006
2007-04-04  1:35     ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).