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))
         (λ ()
           (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.

Reply via email to