From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id F10B6BB81 for ; Fri, 14 Oct 2005 12:08:57 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j9EA8vW9009598 for ; Fri, 14 Oct 2005 12:08:57 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA14347 for ; Fri, 14 Oct 2005 12:08:56 +0200 (MET DST) Received: from mallaury.nerim.net (smtp-105-friday.noc.nerim.net [62.4.17.105]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j9EA8uYa009595 for ; Fri, 14 Oct 2005 12:08:56 +0200 Received: from karryall.dnsalias.org (karryall.dnsalias.org [213.41.180.99]) by mallaury.nerim.net (Postfix) with ESMTP id B38234F3F8; Fri, 14 Oct 2005 12:08:49 +0200 (CEST) Received: by karryall.dnsalias.org (Postfix, from userid 500) id EE614596FAA; Fri, 14 Oct 2005 12:08:55 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Message-ID: <17231.33719.811325.429104@karryall.dnsalias.org> Date: Fri, 14 Oct 2005 12:08:55 +0200 From: Olivier Andrieu To: Richard Jones Cc: caml-list@inria.fr Subject: Re: [Caml-list] Memory usage/ garbage collection question In-Reply-To: <20051014094948.GA11039@furbychan.cocan.org> References: <20051014094948.GA11039@furbychan.cocan.org> X-Mailer: VM 7.19 under Emacs 21.4.1 Content-Transfer-Encoding: quoted-printable X-Miltered: at nez-perce with ID 434F83B9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 434F83B8.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; andrieu:01 andrieu:01 ijm:01 caml-list:01 garbage:01 optimise:01 iteration:01 iteration:01 iter:01 stdlib:01 iter:01 garbage:01 iterated:01 ocamlc:01 ocamlopt:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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. >=20 > 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: >=20 > List.iter ( > fun row -> > (* put row into database and forget about it *) > ) rows; > (* no further references to rows after this *) >=20 > 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. =AB Short answer: with ocamlc, no. With ocamlopt, yes. =BB cf. these informatives messages by Xavier: http://groups.google.com/group/fa.caml/msg/f194a3240d240e71 http://groups.google.com/group/fa.caml/msg/d36cb040d0d87ca6 --=20 Olivier