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

 
 

bug #34140: gc not run correctly when allocating threads

Submitter:  Stefan Israelsson Tampe <tampe>
Submitted:  Fri 26 Aug 2011 08:49:53 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>
Group Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-29 wingo StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code