unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: ludovic.courtes@laas.fr (Ludovic Courtès)
To: Roland Orre <roland.orre@neurologic.se>
Cc: guile-user@gnu.org
Subject: Re: What is best way to limit memory alloc?
Date: Wed, 29 Aug 2007 13:47:30 +0200	[thread overview]
Message-ID: <874pii7eb1.fsf@laas.fr> (raw)
In-Reply-To: <1188367992.8043.508.camel@localhost.localdomain> (Roland Orre's message of "Wed\, 29 Aug 2007 08\:13\:11 +0200")

Hi,

Roland Orre <roland.orre@neurologic.se> 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


      parent reply	other threads:[~2007-08-29 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 10:14 MMCI 1.1.1 available Thien-Thi Nguyen
     [not found] ` <1188367992.8043.508.camel@localhost.localdomain>
2007-08-29 10:22   ` What is best way to limit memory alloc? Roland Orre
2007-08-29 15:20     ` Ludovic Courtès
2007-09-01  0:02     ` Kevin Ryde
2007-08-29 11:47   ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874pii7eb1.fsf@laas.fr \
    --to=ludovic.courtes@laas.fr \
    --cc=guile-user@gnu.org \
    --cc=roland.orre@neurologic.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).