Version française
Home     About     Download     Resources     Contact us    
Browse thread
Memory usage/ garbage collection question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Memory usage/ garbage collection question

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.

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com