Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Bug in Hashtbl ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vesa Karvonen <vesa.karvonen@h...>
Subject: [Caml-list] Bug in Hashtbl ?
Hi,

The following program raises an Out_of_memory exception. Is this:
- correct behavior,
- bug in Ocaml 3.04, or
- bug somewhere else?

<--- weird_out_of_memory.ml --->
type vertex =
  | D of vertex list

let _ =
  let rec n0 = D [n1]
  and n1 = D [n0] in
  let vertices = [n0;n1] in
  let res = Hashtbl.create 0 in
    List.iter
      (fun v -> 
  assert (not (Hashtbl.mem res v)) ;
  Hashtbl.add res v (ref 0))
      vertices ;
    ()
<--- weird_out_of_memory.ml --->

Under Cygwin (1.3.10):

  $ ocamlc.opt -o a.exe -g weird_out_of_memory.ml
  $ a.exe
  Fatal error: exception Out_of_memory
  Raised from a C function
  Called from module Weird_out_of_memory, character 220
  Called from module List, character 1856
  Called from module Weird_out_of_memory, character 270

Regards,
  Vesa Karvonen


-------------------
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