reduce some memory use of `unstable' doc build

by explicitly closing evaluators

original commit: c916e99af584a6db57c33fe06726435a8422b485
This commit is contained in:
Matthew Flatt 2010-12-28 20:34:05 -07:00
commit d09828a019
3 changed files with 25 additions and 7 deletions

View File

@ -34,7 +34,8 @@
(define -text (new browser-text%)) (define -text (new browser-text%))
(define -ecanvas (define -ecanvas
(new canvas:color% (parent -split-panel) (editor -text))) (new canvas:color% (parent -split-panel) (editor -text)))
(define -props-panel (new horizontal-panel% (parent -split-panel))) (define -props-panel
(new horizontal-panel% (parent -split-panel) (style '(deleted))))
(define props (define props
(new properties-view% (new properties-view%
(parent -props-panel) (parent -props-panel)
@ -52,16 +53,25 @@
(define/public (show-props show?) (define/public (show-props show?)
(internal-show-props show?)) (internal-show-props show?))
(define saved-props-percentage #f)
(define/private (internal-show-props show?) (define/private (internal-show-props show?)
(if show? (if show?
(unless (send -props-panel is-shown?) (unless (send -props-panel is-shown?)
(let ([p (send/i config config<%> get-props-percentage)]) (send -split-panel begin-container-sequence)
(let ([p (or saved-props-percentage
(send/i config config<%> get-props-percentage))])
(send -split-panel add-child -props-panel) (send -split-panel add-child -props-panel)
(update-props-percentage p)) (update-props-percentage p))
(send -props-panel show #t)) (send -props-panel show #t)
(send -split-panel end-container-sequence))
(when (send -props-panel is-shown?) (when (send -props-panel is-shown?)
(send -split-panel begin-container-sequence)
(set! saved-props-percentage
(cadr (send -split-panel get-percentages)))
(send -split-panel delete-child -props-panel) (send -split-panel delete-child -props-panel)
(send -props-panel show #f)))) (send -props-panel show #f)
(send -split-panel end-container-sequence))))
(define/private (update-props-percentage p) (define/private (update-props-percentage p)
(send -split-panel set-percentages (send -split-panel set-percentages
@ -220,8 +230,14 @@
(define/private (calculate-columns) (define/private (calculate-columns)
(define style (code-style -text (send/i config config<%> get-syntax-font-size))) (define style (code-style -text (send/i config config<%> get-syntax-font-size)))
(define char-width (send style get-text-width (send -ecanvas get-dc))) (define char-width (send style get-text-width (send -ecanvas get-dc)))
#|
(define-values (canvas-w canvas-h) (send -ecanvas get-client-size)) (define-values (canvas-w canvas-h) (send -ecanvas get-client-size))
(sub1 (inexact->exact (floor (/ canvas-w char-width))))) (sub1 (inexact->exact (floor (/ canvas-w char-width))))
|#
(let ([admin (send -text get-admin)]
[w-box (box 0.0)])
(send admin get-view #f #f w-box #f)
(sub1 (inexact->exact (floor (/ (unbox w-box) char-width))))))
;; Initialize ;; Initialize
(super-new) (super-new)

View File

@ -80,8 +80,8 @@
(define/override (show-props show?) (define/override (show-props show?)
(super show-props show?) (super show-props show?)
(send/i macro-stepper widget<%> update/preserve-view)) (when (send (send/i macro-stepper widget<%> get-config) get-refresh-on-resize?)
(send/i macro-stepper widget<%> update/preserve-view)))
(super-new (super-new
(config (send/i macro-stepper widget<%> get-config))))) (config (send/i macro-stepper widget<%> get-config)))))

View File

@ -75,3 +75,5 @@ procedure or returned otherwise.
(find-first symbol? (shared ([x (cons 'a x)]) x)) (find-first symbol? (shared ([x (cons 'a x)]) x))
] ]
} }
@close-eval[the-eval]