simple placestest.scm:
#lang racket
(require racket/place)
(provide main child)
(define (child ch)
(printf "child exit~n"))
(define (main . argv)
(let loop ((places '()))
(if (< (length places) 10)
(loop (cons (dynamic-place "placestest.scm" 'child) places))
(loop (filter (lambda (pl)
(let ((dead (sync/timeout 0 (place-dead-evt pl))))
(or (not dead)
(and (place-wait pl) #f))))
places)))))
run "racket -t placestest.scm -m"
run shell script, that takes 10000 times rss of racket process and prints minimal:
pid=21479; while :; do i=0; min=10000000000000; while [ $i -lt 10000 ]; do n=`ps -o rss --no-headers -p $pid`; min=$(($n < $min ? $n : $min)); i=$(($i+1)); done; echo $min; done
results:
173496
222588
195856
242100
256072
310104
314964
323700
330020
340088
338372
326592
324264
312044
316548
326552
326888
332612
331816
319940
316048
302032
316792
356084
358192
353040
381460
418864
425872
396864
413488
453320
468796
472476
458992
451932
478644
471304
492824
522756
517472
527532
499744
478676
519708
490356
511716
524064
530632
544140
545808
574856
564688
530788
541820
560396
as you can see - it is slowly, but constantly, grows. i think there is memory leaks somewhere, but i cannot find it, because, as i wrote here before, racket segfaults when run under valgrind. any ideas?