Browse thread
Memory usage/ garbage collection question
-
Richard Jones
- skaller
- Olivier Andrieu
- Richard Jones
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Olivier Andrieu <andrieu@i...> |
| Subject: | Re: [Caml-list] Memory usage/ garbage collection question |
Hi, Richard Jones [Friday 14 October 2005] : > I'm trying to optimise a program which is using a large amount of > memory and consequently thrashing. > > The core of the program is an iteration over a list of something like > a million elements which consumes about 1/2 gig of RAM. The iteration > is: > > List.iter ( > fun row -> > (* put row into database and forget about it *) > ) rows; > (* no further references to rows after this *) > > This is the stdlib implementation of List.iter. Should the garbage > collector be able to collect the part of the list which has been > iterated over, during the iteration? At the moment it doesn't look > like it's doing so. « Short answer: with ocamlc, no. With ocamlopt, yes. » cf. these informatives messages by Xavier: http://groups.google.com/group/fa.caml/msg/f194a3240d240e71 http://groups.google.com/group/fa.caml/msg/d36cb040d0d87ca6 -- Olivier