Also count symbol plists in memory-report
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 30 Dec 2020 07:29:06 +0000 (08:29 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 30 Dec 2020 07:29:06 +0000 (08:29 +0100)
* lisp/emacs-lisp/memory-report.el (memory-report--symbol-plist):
New function.
(memory-report): Use it.

lisp/emacs-lisp/memory-report.el

index 332749987c4e7bab7a038b67c05eb08233ed3c9c..1cb9ad15316265a2c5801117c4ab3932e1e874c6 100644 (file)
@@ -48,6 +48,7 @@ by counted more than once."
   (message "Gathering data...")
   (let ((reports (append (memory-report--garbage-collect)
                          (memory-report--image-cache)
+                         (memory-report--symbol-plist)
                          (memory-report--buffers)
                          (memory-report--largest-variables)))
         (inhibit-read-only t)
@@ -159,6 +160,17 @@ by counted more than once."
                            "\n"))
        (buffer-string)))))
 
+(defun memory-report--symbol-plist ()
+  (let ((counted (make-hash-table :test #'eq))
+        (total 0))
+    (mapatoms
+     (lambda (symbol)
+       (cl-incf total (memory-report--object-size
+                       counted (symbol-plist symbol))))
+     obarray)
+    (list
+     (cons "Memory Used By Symbol Plists" total))))
+
 (defun memory-report--object-size (counted value)
   (if (gethash value counted)
       0