Hi,

On Thu 05 Aug 2010 15:42, Luca Saiu <posit...@gnu.org> writes:

> ;;; Why does this GCs after creating b?  Try running this with 
> GC_PRINT_STATS=1,
> ;;; or with GC_DONT_GC=1 if you want to see the memory use rise.
>
> (define size 100000)
> (define times 100)
>
> (define b (make-bitvector size))
>
> (do ((t 0 (1+ t)))
>     ((= t times) 'done)
>   (do ((i 0 (1+ i)))
>       ((= i size) 'done)
>     (bitvector-set! b i #t)))

The toplevel references to bitvector-set! don't get cached, so the
bitvector-set! gets looked up every time, and there is some unfortunate
allocation in scm_from_locale_symboln. If you put it in a function,
the variable gets cached, and there's no allocation.

Andy
-- 
http://wingolog.org/

Reply via email to