unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #34140] gc not run correctly when allocating threads
@ 2011-08-26  8:49 Stefan Israelsson Tampe
  2011-09-01  8:57 ` Stefan Israelsson Tampe
  2011-09-03 11:56 ` Andy Wingo
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Israelsson Tampe @ 2011-08-26  8:49 UTC (permalink / raw)
  To: Stefan Israelsson Tampe, bug-guile

URL:
  <http://savannah.gnu.org/bugs/?34140>

                 Summary: gc not run correctly when allocating threads
                 Project: Guile
            Submitted by: tampe
            Submitted on: Fri 26 Aug 2011 08:49:53 AM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

On my machine this crashes after about 4000 iterations due to the oom killer.
The reason is mainly that stack space is not reclaimed.

(define (f n)
  (let ((t (call-with-new-thread (lambda () 'ok))))
    (join-thread t))
  (if (= (modulo n 30) 0) 
     (begin
        (pk n) 
        (pk (gc-stats)) 
        (sleep 1)))
  (f (+ n 1)))

  (f 0)

On the other hand this code works perfectly (a explicit call to gc is used)
(define (f n)

  (let ((t (call-with-new-thread (lambda () 'ok))))
    (join-thread t))
  (if (= (modulo n 10) 0) (pk (gc-stats)))
  (if (= (modulo n 300) 0) (begin (pk n)  (gc) (sleep 1)))
  (f (+ n 1)))

  (f 0)

It would be nice if the spawning of threads checked to gc stats
to run the gc appropriatly if there is not so much space left to allow for a
new thread.

/Stefan




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34140>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-05  8:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26  8:49 [bug #34140] gc not run correctly when allocating threads Stefan Israelsson Tampe
2011-09-01  8:57 ` Stefan Israelsson Tampe
2011-09-03 11:56 ` Andy Wingo
     [not found]   ` <CAGua6m2wtf1YLGzMLtZ+U4UiU8nmn5wUY3W-5qbYTx30EpSusg@mail.gmail.com>
2011-09-05  8:45     ` Andy Wingo

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).