From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: What is best way to limit memory alloc? Date: Wed, 29 Aug 2007 13:47:30 +0200 Organization: LAAS-CNRS Message-ID: <874pii7eb1.fsf@laas.fr> References: <1188367992.8043.508.camel@localhost.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1188388110 4449 80.91.229.12 (29 Aug 2007 11:48:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 29 Aug 2007 11:48:30 +0000 (UTC) Cc: guile-user@gnu.org To: Roland Orre Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Aug 29 13:48:29 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IQM27-0007iq-O1 for guile-user@m.gmane.org; Wed, 29 Aug 2007 13:48:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IQM27-0002tU-Gl for guile-user@m.gmane.org; Wed, 29 Aug 2007 07:48:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IQM13-0001jn-IB for guile-user@gnu.org; Wed, 29 Aug 2007 07:47:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IQM12-0001iH-IB for guile-user@gnu.org; Wed, 29 Aug 2007 07:47:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IQM12-0001hi-Bz for guile-user@gnu.org; Wed, 29 Aug 2007 07:47:20 -0400 Original-Received: from laas.laas.fr ([140.93.0.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IQM11-0006CK-QE for guile-user@gnu.org; Wed, 29 Aug 2007 07:47:20 -0400 Original-Received: from messiaen.laas.fr (messiaen [IPv6:2001:660:6602:0:230:65ff:fed4:9d20]) by laas.laas.fr (8.13.8/8.13.8) with SMTP id l7TBlHhs003958; Wed, 29 Aug 2007 13:47:17 +0200 (MEST) Original-Received: by messiaen.laas.fr (sSMTP sendmail emulation); Wed, 29 Aug 2007 13:47:30 +0200 X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 12 Fructidor an 215 de la =?iso-8859-1?Q?R=E9volutio?= =?iso-8859-1?Q?n?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Roland Orre , guile-user@gnu.org In-Reply-To: <1188367992.8043.508.camel@localhost.localdomain> (Roland Orre's message of "Wed\, 29 Aug 2007 08\:13\:11 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Spam-Score: -0.001 () NO_RELAYS X-Scanned-By: MIMEDefang at CNRS-LAAS on IPv6:2001:660:6602::2 X-Detected-Kernel: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6114 Archived-At: Hi, Roland Orre writes: > What is the best way to limit the memory allocation in guile? First, make sure Guile's GC knows about every bit of memory that you allocate. This means that C code run from your Guile program must use `scm_gc_malloc ()' et al. If you don't do this, Guile's GC will think that less memory is used than what is actually used, so it will GC less often than needed. Also, make sure to compile Guile with `-O2', otherwise it is more likely that references in the stack to Scheme objects will be visible much longer than needed. Similarly, make sure your Scheme code doesn't unduly keeps references to objects that are no longer needed. > Then when performing the last step, just involving reading > from a file, doing some string split for each line, adding > some data and writing it back to the file line per line, the > memory suddenly increases to 8.8 GB and then the job starts > swapping ridicously and stops of course. Of course, there could also be a bug. :-) If you get convinced that this is the case, you can try to reproduce it with a simple test case (typically: run the suspicious code in an endless loop and see what happens). > I'm still running 1.7 as I haven't got the time and energy > to change the array implementation yet. The array API hasn't changed between 1.7.2 and 1.8.x, so you could hopefully upgrade with little troubles. Thanks, Ludovic. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user