bugGuile - Bugs: bug #34140, gc not run correctly when...

 
 

bug #34140: gc not run correctly when allocating threads

Submitted by:  Stefan Israelsson Tampe <tampe>
Submitted on:  Fri 26 Aug 2011 08:49:53 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 29 Nov 2011 07:30:00 PM UTC, comment #2:

Fixed in git, by collecting a little before creating the new thread.

Andy Wingo <wingo>
Project Administrator
Thu 01 Sep 2011 08:57:19 AM UTC, comment #1:

When running the script below with explicit gc, one notice an avarage leak of 350 bytes per thread allocation. The origin of this
is kind of strange because many times the gc-stats are identical from run to run indicating that the leak is not systematic.

/Stefan

Stefan Israelsson Tampe <tampe>
Project Member
Fri 26 Aug 2011 08:49:53 AM UTC, original submission:

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

Stefan Israelsson Tampe <tampe>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by wingo (Posted a comment)
  • -unavailable- added by tampe (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 29 Nov 2011 07:30:00 PM UTCwingoStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1