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 17:20:07 +0200 [thread overview]
Message-ID: <87y7fu2wrc.fsf@laas.fr> (raw)
In-Reply-To: <1188382968.8043.578.camel@localhost.localdomain> (Roland Orre's message of "Wed\, 29 Aug 2007 12\:22\:47 +0200")
Roland Orre <roland.orre@neurologic.se> writes:
> I found out that I had already solved the memory allocation
> problem in one way a few years ago.
> With the help of a small routine gc-heap-size, which accesses
> scm_i_master_freelist.heap_size
> scm_i_master_freelist2.heap_size
> I did:
> (define gc-heap1 (gc-heap-size 1))
> (define gc-heap2 (gc-heap-size 2))
> (let loop
> ....
> (gc-heap-size 1 gc-heap1)
> (gc-heap-size 2 gc-heap2)
> (loop ...))
> By not allowing the heap size to increase.
That seems brutal. ;-) What does `gc-heap-size' do exactly?
Another way would have been to fiddle with the `GUILE_MIN_YIELD_1' and
`GUILE_MIN_YIELD_2' environment variables. These variables tell the GC
when it should grow the heap for the first and second freelist,
respectively. More precisely, the GC does:
if (number-of-cells-collected-recently < GUILE_MIN_YIELD_X)
then
allocate-new-heap
else
run-a-collection
(This takes place in `scm_i_gc_grow_heap_p ()' and `scm_gc_for_newcell ()'.)
The default value for `GUILE_MIN_YIELD_{1,2}' is 40, which means that if
the last GC run did not yield more than 40 cells, then more heap is
allocated.
If you set it to some _higher_ value, then the GC should be more
conservative and less memory-hungry, at the cost of being slower.
Thanks,
Ludovic.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2007-08-29 15:20 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 [this message]
2007-09-01 0:02 ` Kevin Ryde
2007-08-29 11:47 ` Ludovic Courtès
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=87y7fu2wrc.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).