From cbec8009be8c7c49607ec3fe06fbba2178ed2f06 Mon Sep 17 00:00:00 2001 From: BlahGeek Date: Sat, 14 Aug 2021 18:01:17 +0800 Subject: [PATCH] Fix memory-report--object-size for hashtable and vectors Previously the elements get inserted to the 'counted' table *before* they get accounted. That operation is unnecessary because it will be done at the beginning of `memory-report--object-size` --- lisp/emacs-lisp/memory-report.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/memory-report.el b/lisp/emacs-lisp/memory-report.el index 1125dde405..1815deec40 100644 --- a/lisp/emacs-lisp/memory-report.el +++ b/lisp/emacs-lisp/memory-report.el @@ -230,7 +230,7 @@ memory-report--object-size-1 (let ((total (+ (memory-report--size 'vector) (* (memory-report--size 'object) (length value))))) (cl-loop for elem across value - do (setf (gethash elem counted) t) + do (cl-incf total (memory-report--object-size counted elem))) total)) @@ -239,8 +239,6 @@ memory-report--object-size-1 (* (memory-report--size 'object) (hash-table-size value))))) (maphash (lambda (key elem) - (setf (gethash key counted) t) - (setf (gethash elem counted) t) (cl-incf total (memory-report--object-size counted key)) (cl-incf total (memory-report--object-size counted elem))) value) -- 2.32.0