Subject: bug#60255: Memory Leak

From: Ryan Wilson <[email-masked]>
Date: Wed, 21 Dec 2022 18:48:02 -0800

I am just using emacs normally, mostly for typescript development, so
that might be the offending mode. Emacs is currently using 1.7GB of
memory, the other day I killed it after I saw it was using 19.9GB. I ran
memory report and nothing was reported as using significant memory.

Memory report output
---
Estimated Emacs Memory Usage

 138.1 MiB  Overall Object Memory Usage
  41.9 MiB  Total Buffer Memory Usage
  17.6 MiB  Memory Used By Global Variables
  13.8 MiB  Reserved (But Unused) Object Memory
   7.8 MiB  Memory Used By Symbol Plists
 187.2 KiB  Total Image Cache Size

Object Storage

  98.2 MiB  Vectors
  18.9 MiB  Strings
  15.8 MiB  Conses
   3.0 MiB  Symbols
   2.1 MiB  Intervals
  35.8 KiB  Buffer-Objects
   5.2 KiB  Floats

Largest Buffers

  13.2 MiB  *LSP Symbols List*
  11.9 MiB  censored.ts
   6.9 MiB  censored.ts
   3.6 MiB  censored.ts
   2.8 MiB  censored.ts
   1.4 MiB  censored.ts
 977.3 KiB  censored.ts
 394.5 KiB  *Flycheck errors*
 168.0 KiB   *helm candidates:Emacs Commands*
 137.9 KiB  *helm M-x*
  84.5 KiB  init.el
  53.9 KiB  lsp-headerline.el
  39.5 KiB  *helm occur*
  39.2 KiB  *Memory Report*
  33.2 KiB  *helm find files*
  32.0 KiB   *helm candidates:Helm occur*
  29.7 KiB  *lsp-log*
  24.0 KiB  *helm-mode-switch-to-buffer*
  15.9 KiB  *scratch*
  15.8 KiB  *Messages*

Largest Variables

   5.0 MiB  package-archive-contents
   1.6 MiB  load-history
 631.1 KiB  lsp-clients
 580.7 KiB  lsp--session
 575.6 KiB  lsp--last-active-workspaces
 415.4 KiB  face--new-frame-defaults
 388.2 KiB  easy-menu-converted-items-table
 327.7 KiB  treemacs--themes
 323.9 KiB  yas--tables
 309.4 KiB  package--compatibility-table
 269.9 KiB  mailcap--computed-mime-data
 236.3 KiB  obarray
 222.3 KiB  treemacs--current-theme
 214.2 KiB  minor-mode-map-alist
 212.5 KiB  definition-prefixes
 143.8 KiB  org-entities
 133.2 KiB  company-keywords-alist
 120.1 KiB  package-alist
 117.7 KiB  shortdoc--groups
 102.6 KiB  global-map

---

In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.16.0)
 of 2022-08-01 built on OAK-0021-LL
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.5 LTS

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: TypeScript

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  gcmh-mode: t
  lsp-diagnostics-mode: t
  lsp-modeline-workspace-status-mode: t
  lsp-modeline-code-actions-mode: t
  company-mode: t
  lsp-ui-mode: t
  lsp-ui-doc-mode: t
  flycheck-mode: t
  lsp-headerline-breadcrumb-mode: t
  lsp-completion-mode: t
  global-hl-todo-mode: t
  hl-todo-mode: t
  helm-descbinds-mode: t
  helm-mode: t
  helm-minibuffer-history-mode: t
  helm--remap-mouse-mode: t
  async-bytecomp-package-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  key-chord-mode: t
  shell-dirtrack-mode: t
  dap-tooltip-mode: t
  dap-ui-many-windows-mode: t
  dap-ui-controls-mode: t
  dap-ui-mode: t
  auto-revert-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  tree-sitter-hl-mode: t
  global-tree-sitter-mode: t
  tree-sitter-mode: t
  dap-auto-configure-mode: t
  dap-mode: t
  lsp-managed-mode: t
  lsp-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  which-key-mode: t
  desktop-save-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  electric-pair-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/ryanwilson/.emacs.d/custom-packages/wolfram-console hides
/home/ryanwilson/.emacs.d/git/ob-wolfram/wolfram-console
/home/ryanwilson/.emacs.d/custom-packages/ob-wolfram hides
/home/ryanwilson/.emacs.d/git/ob-wolfram/ob-wolfram
/home/ryanwilson/.emacs.d/elpa-28.1/transient-20220717.1713/transient hides
/usr/local/share/emacs/28.1/lisp/transient

Features:
(shadow sort mail-extr emacsbug sendmail magit-bookmark magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode diff git-commit log-edit pcvs-util add-log magit-core
magit-autorevert magit-margin magit-transient magit-process with-editor
magit-mode transient magit-git magit-base magit-section crm compat-27
compat-26 cus-start vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs
vc-rcs vc memory-report gcmh image-file image-converter helm-external
helm-net ffap mule-util misearch multi-isearch winner tramp-archive
tramp-gvfs tramp-cache zeroconf dbus helm-command helm-elisp helm-eval
edebug backtrace helm-info ace-window avy lsp-diagnostics lsp-modeline
flycheck-rust company-oddmuse company-keywords make-mode company-etags
etags fileloop company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb company lsp-ui lsp-ui-flycheck lsp-ui-doc
goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline flycheck lsp-ui-util
face-remap view lsp-zig lsp-steep lsp-svelte lsp-sqls
lsp-ruby-syntax-tree lsp-yaml lsp-xml lsp-vimscript lsp-vhdl lsp-volar
lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v lsp-typeprof lsp-ttcn3
lsp-toml lsp-terraform lsp-tex lsp-sorbet lsp-solargraph lsp-rust lsp-rf
lsp-remark lsp-racket lsp-r lsp-purescript lsp-pylsp lsp-pyls lsp-pwsh
lsp-php lsp-pls lsp-perlnavigator lsp-perl lsp-openscad lsp-ocaml
lsp-magik lsp-nix lsp-nim lsp-nginx lsp-mint lsp-marksman lsp-markdown
lsp-lua lsp-kotlin lsp-json lsp-javascript lsp-idris lsp-haxe lsp-groovy
lsp-hack lsp-graphql lsp-gleam lsp-go lsp-gdscript lsp-fsharp
lsp-fortran lsp-eslint lsp-erlang lsp-emmet lsp-elixir lsp-elm
lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp lsp-crystal lsp-cmake
lsp-clojure lsp-semantic-tokens lsp-clangd lsp-beancount lsp-bash
lsp-astro lsp-ansible lsp-angular lsp-ada lsp-actionscript
lsp-headerline lsp-icons vc-git vc-dispatcher server init tabbar patches
youdao-dictionary pos-tip popup chinese-word-at-point ravar-custom circe
diff-mode lui-irc-colors irc lcs lui-logging lui-format lui tracking
shorten flyspell ispell circe-compat diminish string-inflection tsx-mode
tsi-typescript tsi-css tsi lsp-completion lsp coverlay js css-mode smie
sgml-mode facemenu eww xdg mm-url gnus nnheader origami origami-parsers
typescript-mode elfeed-show elfeed-search treemacs-bookmarks bookmark
shr kinsoku svg elfeed-csv elfeed elfeed-curl elfeed-log elfeed-db
elfeed-lib avl-tree generator url-queue xml-query hl-todo compat
pyim-basedict pyim-dict helm-descbinds helm-mode helm-misc helm-files
image-dired image-mode exif helm-buffers helm-occur helm-tags
helm-locate helm-grep helm-regexp helm-utils helm-help helm-types helm
helm-global-bindings helm-easymenu helm-core async-bytecomp helm-source
helm-multi-match helm-lib async helm-config keyfreq pdf-loader web-mode
disp-table flymake-proc flymake warnings man key-chord ob-clojure
ob-ipython dash-functional ob-python python tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
parse-time ls-lisp org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete pcomplete
org-list org-faces org-entities org-version ob-emacs-lisp ob-core
ob-eval org-table oc-basic bibtex iso8601 ol org-keys oc org-compat
org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs dap-mouse dap-ui gdb-mi gud bui bui-list bui-info bui-entry
bui-core bui-history bui-button bui-utils cus-edit cus-load lsp-lens
column-marker dap-java lsp-java request autorevert lsp-treemacs
lsp-treemacs-themes treemacs treemacs-header-line treemacs-compatibility
treemacs-mode treemacs-interface treemacs-extensions
treemacs-mouse-interface treemacs-tags treemacs-persistence
treemacs-filewatch-mode treemacs-follow-mode treemacs-rendering
treemacs-annotations treemacs-async treemacs-workspaces treemacs-dom
treemacs-visuals treemacs-fringe-indicator treemacs-scope pulse
treemacs-faces treemacs-icons treemacs-themes treemacs-core-utils
pfuture hl-line treemacs-logging treemacs-customization treemacs-macros
tree-sitter-langs tree-sitter-langs-build tar-mode arc-mode archive-mode
pp tree-sitter-hl tree-sitter tree-sitter-load tree-sitter-cli tsc
tsc-dyn tsc-dyn-get dired-aux tsc-obsolete init-go init-rust mm-archive
message rfc822 mml mml-sec epa gnus-util rmail rmail-loaddefs time-date
mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils
gnutls url-http mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw url-cache url-auth chuck-mode cc-langs cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs dap-go dap-utils dom xml dap-mode derived dap-launch lsp-docker
yaml posframe dap-overlays lsp-mode lsp-protocol yasnippet-snippets
cl-extra yasnippet help-mode xref project tree-widget wid-edit spinner
network-stream puny nsm rmc markdown-mode rx color thingatpt noutline
outline lv inline imenu ht filenotify f f-shortdoc shortdoc s ewoc epg
rfc6068 epg-config dired-subtree dired-hacks-utils dired dired-loaddefs
dash which-key monokai-theme init-optional langtool pcase compile
text-property-search comint ansi-color ring i3-integration i3 bindat
desktop frameset display-line-numbers elec-pair edmacro kmacro init-git
use-package use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core init-exec-path
exec-path-from-shell init-elpa fullframe finder-inf tex-site info advice
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap url-handlers
url-parse auth-source eieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x map url-vars seq byte-opt bytecomp
byte-compile cconv init-site-lisp cl-seq cl gv cl-loaddefs cl-lib
init-utils iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 1039516 217197)
 (symbols 48 66235 82)
 (strings 32 348492 61731)
 (string-bytes 1 8769221)
 (vectors 16 277399)
 (vector-slots 8 12325809 1143544)
 (floats 8 673 1062)
 (intervals 56 39196 2180)
 (buffers 992 40))