Running the following code in gambit's repl causes its memory usage to shoot up and end up making the whole pc unresponsive.
(define t (make-table min-load: 0.75 max-load: 0.95)) (table-set! t 0 0) (table-set! t 1 1) (table-set! t 2 2) (table-set! t 3 3) (table-set! t 4 4)
I managed to interrupt it in gsi and get the following backtrace (I could never get it to interrupt in gsc):
(define t (make-table min-load: 0.75 max-load: 0.95)) (table-set! t 0 0) (table-set! t 1 1) (table-set! t 2 2) (table-set! t 3 3) (table-set! t 4 4)
*** INTERRUPTED IN ##equal?-hash 1> ,b 0 ##equal?-hash 1 ##table-access 2 ##table-resize! 3 ##table-resize! 4 ##table-resize! 5 ##table-resize! 6 ##table-resize! 7 ##table-resize! 8 ##table-resize! 9 ##table-resize! ... 654294 ##table-resize! 654295 ##table-resize! 654296 ##table-resize! 654297 (interaction) (console)@6:1 (table-set! t 4 4) 1>
600,000 resizes -.-
I noticed that (- 0.95 0.75) gives .19999999999999996 on my system, so I set min-load to 0.74, which brings the difference between min and max to .20999999999999996 - above the stated minimum of 0.20. ut the problem persists. Setting min-load to 0.73 eliminates the problem, so perhaps it is merely an inaccuracy in the documentation.
I'm running beta 20.
Cheers,
TJ
Afficher les réponses par date
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 31-Jan-07, at 4:33 AM, TJ wrote:
Running the following code in gambit's repl causes its memory usage to shoot up and end up making the whole pc unresponsive.
(define t (make-table min-load: 0.75 max-load: 0.95)) (table-set! t 0 0) (table-set! t 1 1) (table-set! t 2 2) (table-set! t 3 3) (table-set! t 4 4)
Fixed. This was an off-by-one error in the computation of the new table size (the code was truncating a float instead of computing the ceiling). Because of this the new table was the same size, so when the elements were transferred to the new table it caused a new attempt to resize the table, and so on forever.
You can correct the problem by replacing the head of procedure ##gc- hash-table-resize! in lib/_system.scm by:
(define-prim (##gc-hash-table-resize! gcht loads) (let* ((count (macro-gc-hash-table-count gcht)) (n (##fixnum.+ 1 (##flonum.->fixnum (##flonum./ (##flonum.<-fixnum count) (##f64vector-ref loads 1))))))
Marc