added a message in the 'program is shutdown' dialog that indicates if it ran out of memory

svn: r6097
This commit is contained in:
Robby Findler 2007-04-29 22:09:07 +00:00
parent 5ac3fdd86e
commit 6e256634b9
3 changed files with 21 additions and 25 deletions

View File

@ -536,17 +536,22 @@ TODO
(make-object string-snip% "[err]")))) (make-object string-snip% "[err]"))))
(define (no-user-evaluation-message frame exit-code memory-killed?) (define (no-user-evaluation-message frame exit-code memory-killed?)
; (printf "memory-killed? ~s\n" memory-killed?)
(message-box (message-box
(string-constant evaluation-terminated) (string-constant evaluation-terminated)
(if exit-code (string-append
(string-append (string-constant evaluation-terminated-explanation)
(string-constant evaluation-terminated-explanation) (if exit-code
"\n\n" (string-append
(if (zero? exit-code) "\n\n"
(string-constant exited-successfully) (if (zero? exit-code)
(format (string-constant exited-with-error-code) exit-code))) (string-constant exited-successfully)
(string-constant evaluation-terminated-explanation)) (format (string-constant exited-with-error-code) exit-code)))
"")
(if memory-killed?
(string-append
"\n\n"
(string-constant program-ran-out-of-memory))
""))
frame)) frame))
;; insert/delta : (instanceof text%) (union snip string) (listof style-delta%) *-> (values number number) ;; insert/delta : (instanceof text%) (union snip string) (listof style-delta%) *-> (values number number)
@ -903,13 +908,7 @@ TODO
(user-custodian-parent #f) (user-custodian-parent #f)
(memory-killed-thread #f) (memory-killed-thread #f)
(user-custodian #f) (user-custodian #f)
(custodian-limit (and (with-handlers ([exn:fail:unsupported? (λ (x) #f)]) (custodian-limit (and (custodian-memory-accounting-available?)
(let ([c (make-custodian)])
(custodian-limit-memory
c
100
c))
#t)
(preferences:get 'drscheme:limit-memory))) (preferences:get 'drscheme:limit-memory)))
(user-eventspace-box (make-weak-box #f)) (user-eventspace-box (make-weak-box #f))
(user-namespace-box (make-weak-box #f)) (user-namespace-box (make-weak-box #f))

View File

@ -2827,13 +2827,7 @@ module browser threading seems wrong.
(λ (_1 _2) (send interactions-text kill-evaluation)) (λ (_1 _2) (send interactions-text kill-evaluation))
#\k #\k
(string-constant kill-menu-item-help-string)) (string-constant kill-menu-item-help-string))
(when (with-handlers ([exn:fail:unsupported? (λ (x) #f)]) (when (custodian-memory-accounting-available?)
(let ([c (make-custodian)])
(custodian-limit-memory
c
100
c))
#t)
(new menu-item% (new menu-item%
[label "Limit memory..."] [label "Limit memory..."]
[parent scheme-menu] [parent scheme-menu]

View File

@ -1044,10 +1044,13 @@ please adhere to these guidelines:
(evaluation-terminated-explanation (evaluation-terminated-explanation
"The evaluation thread is no longer running, so no evaluation can take place until the next execution.") "The evaluation thread is no longer running, so no evaluation can take place until the next execution.")
; next two constants show up in the same dialog as the above evaluation-terminated string ; The next three constants show up in the same dialog as the above evaluation-terminated string
; constants, but only when the user calls 'exit' (possibly with a status code). ; constants.
; The first two show up only when the user calls 'exit' (possibly with a status code).
; The third shows up when the program runs out of memory.
(exited-successfully "Exited successfully.") (exited-successfully "Exited successfully.")
(exited-with-error-code "Exited with error code ~a.") ;; ~a is filled in with a number between 1 and 255 (exited-with-error-code "Exited with error code ~a.") ;; ~a is filled in with a number between 1 and 255
(program-ran-out-of-memory "The program ran out of memory.")
(last-stack-frame "show the last stack frame") (last-stack-frame "show the last stack frame")
(last-stack-frames "show the last ~a stack frames") (last-stack-frames "show the last ~a stack frames")
(next-stack-frames "show the next ~a stack frames") (next-stack-frames "show the next ~a stack frames")