raco exe: fix excessive memory use
Avoid retaining namespaces that are created to gather runtime paths. If expansion generates a lot of instances with a lot of type information, for example, this repair can save a lot of space.
This commit is contained in:
parent
f9551bcaa5
commit
9ce4dd8770
|
@ -546,18 +546,28 @@
|
||||||
(module-compiled-submodules code #f null)
|
(module-compiled-submodules code #f null)
|
||||||
#t
|
#t
|
||||||
null))
|
null))
|
||||||
(eval no-submodule-code)
|
|
||||||
(let ([module-path
|
(let ([module-path
|
||||||
(if (path? module-path)
|
(if (path? module-path)
|
||||||
(path->complete-path module-path)
|
(path->complete-path module-path)
|
||||||
module-path)])
|
module-path)])
|
||||||
|
(unless (module-declared? module-path)
|
||||||
|
(parameterize ([current-module-declare-name
|
||||||
|
(module-path-index-resolve (module-path-index-join
|
||||||
|
module-path
|
||||||
|
#f))])
|
||||||
|
(eval no-submodule-code)))
|
||||||
(define e (expand `(,#'module m racket/kernel
|
(define e (expand `(,#'module m racket/kernel
|
||||||
(#%require (only ,module-path)
|
(#%require (only ,module-path)
|
||||||
racket/runtime-path)
|
racket/runtime-path)
|
||||||
(runtime-paths ,module-path))))
|
(runtime-paths ,module-path))))
|
||||||
(syntax-case e (quote)
|
(syntax-case e (quote)
|
||||||
[(_ m mz (#%mb req (quote (spec ...))))
|
[(_ m mz (#%mb req (quote (spec ...))))
|
||||||
(syntax->datum #'(spec ...))]
|
(for/list ([p (in-list (syntax->datum #'(spec ...)))])
|
||||||
|
;; Strip variable reference from 'module specs, because
|
||||||
|
;; we don't need them and they retain the namespace:
|
||||||
|
(if (and (pair? p) (eq? 'module (car p)))
|
||||||
|
(list 'module (cadr p))
|
||||||
|
p))]
|
||||||
[_else (error 'create-empbedding-executable
|
[_else (error 'create-empbedding-executable
|
||||||
"expansion mismatch when getting external paths: ~e"
|
"expansion mismatch when getting external paths: ~e"
|
||||||
(syntax->datum e))]))))]
|
(syntax->datum e))]))))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user