Function: js-gc
js-gc is an interactive and byte-compiled function defined in
js.el.gz.
Signature
(js-gc &optional FORCE)
Documentation
Tell the repl about any objects we don't reference anymore.
With argument, run even if no intervening GC has happened.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/js.el.gz
(defun js-gc (&optional force)
"Tell the repl about any objects we don't reference anymore.
With argument, run even if no intervening GC has happened."
(interactive)
(when force
(setq js--js-last-gcs-done nil))
(let ((this-gcs-done gcs-done) keys num)
(when (and js--js-references
(boundp 'inferior-moz-buffer)
(buffer-live-p inferior-moz-buffer)
;; Don't bother running unless we've had an intervening
;; garbage collection; without a gc, nothing is deleted
;; from the weak hash table, so it's pointless telling
;; MozRepl about that references we still hold
(not (eq js--js-last-gcs-done this-gcs-done))
;; Are we looking at a normal prompt? Make sure not to
;; interrupt the user if he's doing something
(with-current-buffer inferior-moz-buffer
(save-excursion
(goto-char (point-max))
(looking-back js--js-prompt-regexp
(save-excursion (forward-line 0) (point))))))
(setq keys (cl-loop for x being the hash-keys
of js--js-references
collect x))
(setq num (js--js-funcall '(repl "_jsGC") (or keys [])))
(setq js--js-last-gcs-done this-gcs-done)
(when (called-interactively-p 'interactive)
(message "Cleaned %s entries" num))
num)))