On Wed, Apr 29, 2009 at 15:19, Brighten Godfrey <p...@cs.berkeley.edu> wrote: > You seem to have solved my problem. But out of curiosity: Do you know how > the GC settings in the Str library differ from PCRE's, and why? Why does > PCRE need to explicitly trigger GCs at all?
Str regular expressions are pure OCaml-values, whereas PCRE regexps are allocated on the C-heap. Since C-heap values need to be deallocated explicitly, a finalizer has to be installed that does the job if the OCaml-value is not reachable anymore. The OCaml-runtime needs hints about how large these C-values are. Otherwise it may not scan the OCaml-heap aggressively enough, leaving a lot of those C-values floating around and eating up your memory. Right now the PCRE-library guarantees that not more than 500 regular expressions will float around at any one time. This can lead to considerable slowdowns if your OCaml-heap is large and you allocate regular expressions at very high rates. Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mo...@gmail.com _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs