bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #34140] gc not run correctly when allocating threads


From: Stefan Israelsson Tampe
Subject: [bug #34140] gc not run correctly when allocating threads
Date: Fri, 26 Aug 2011 08:49:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]