Yes, it's effectively in words (so 8 bytes on a 64-bit platform, 4
bytes on a 32-bit platform), since the count refers to Racket values
that are represented by pointers.

You can set the value to be a small as you want, since the stack is
grown as needed, but even the simplest program will need a dozen or so
words.

At Sun, 3 Sep 2017 15:23:30 -0400, Greg Hendershott wrote:
> Empirically it seems to be 8-byte words?
> 
> Unless I made a mistake:
> 
>     #lang at-exp racket/base
> 
>     (require racket/format)
> 
>     (define (current-custodian-memory-use)
>       (for ([_ (in-range 3)]) (collect-garbage))
>       (current-memory-use (current-custodian)))
> 
>     (define (f v)
>       (parameterize ([current-thread-initial-stack-size v]
>                      [current-custodian (make-custodian)])
>         (define ch (make-channel))
>         (thread
>          (λ ()
>            (channel-put ch (current-custodian-memory-use))))
>         (channel-get ch)))
> 
>     (f 1024) ;=> 12944
>     (f 2048) ;=> 21136
>     (f 4096) ;=> 37520
> 
>     (define (diff v1 v2)
>       (define f1 (f v1))
>       (define f2 (f v2))
>       @~a{Initial stack sizes of @v1 and @v2
>           seem to consume @f1 and @f2 bytes respectively.
>           Diff in stack sizes is @(- v2 v1).
>           Diff in memory is @(- f2 f1).
>           Factor is @(/ (- f2 f1) (- v2 v1)) bytes.})
> 
>     (displayln (diff 2048 4096))
>     ;; Initial stack sizes of 2048 and 4096
>     ;; seem to consume 21136 and 37520 bytes respectively.
>     ;; Diff in stack sizes is 2048.
>     ;; Diff in memory is 16384.
>     ;; Factor is 8 bytes.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to