#lang scheme/base

(require scheme/gui/base)

(define-struct thingy (foo bar baz))

(define (main)
  (collect-garbage)
  (let ((before (current-memory-use)))
    (let ((junk
           (for/list ((index (in-range 100000)))
             (make-thingy (current-custodian) (current-continuation-marks) (current-eventspace)))))
      (collect-garbage)
      (let ((after (current-memory-use))
            (memory-hogger (car junk))) ; prevents optimizer from collecting junk before "after" is calculated
        (exact->inexact (/ (- after before) 100000))))))
(provide main)