From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: NS port: How to debug excessive garbage collection?
Date: Fri, 12 Apr 2019 22:55:42 -0700 [thread overview]
Message-ID: <m28swejvoh.wl%esq@lawlist.com> (raw)
Thank you, Eli, for letting me know that my previous test was not the correct way to do it. I added a little bit of code from garbage-collect to garbage_collect_1 so that messages to stderr are automatically generated when garbage collection occurs.
In all three (3) of the new tests, I used the following Lisp code at the outset and then held down the right arrow key (right-char) in the *GNU Emacs* welcome buffer:
(progn
(blink-cursor-mode -1)
(global-eldoc-mode -1)
(setq timer-list nil
timer-idle-list nil))
============================
;;; begin STOCK / UNMODIFIED Emacs
((conses 16 12347 39900)
(symbols 48 1746 1)
(strings 32 4057 438)
(string-bytes 1 117832)
(vectors 16 3477)
(vector-slots 8 52314 9400)
(floats 8 7 17)
(intervals 56 54 26)
(buffers 992 9))
;;; end STOCK UNMODIFIED Emacs
============================
;;; begin MODIFIED Emacs -- CROSSHAIRS "OFF"
((conses 16 4624 17450)
(symbols 48 1312 0)
(strings 32 580 1807)
(string-bytes 1 34827)
(vectors 16 3638)
(vector-slots 8 52667 12372)
(floats 8 17 425)
(intervals 56 51 29)
(buffers 1072 8))
;;; end MODIFIED Emacs -- CROSSHAIRS "OFF"
============================
;;; begin MODIFIED Emacs -- CROSSHAIRS "ON"
((conses 16 6032 17006)
(symbols 48 1314 1)
(strings 32 595 1854)
(string-bytes 1 36097)
(vectors 16 3729)
(vector-slots 8 53337 12722)
(floats 8 264 805)
(intervals 56 53 27)
(buffers 1072 9))
;;; end MODIFIED Emacs -- CROSSHAIRS "ON"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Here is the diff I used to automatically generate messages to stderr during garbage collection:
diff --git a/src/alloc.c b/src/alloc.c
index dd78386..b503b74 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6206,6 +6206,53 @@ garbage_collect_1 (struct gcstat *gcst)
*gcst = gcstat;
+
+/* *************************************************************************** */
+/* begin DEBUGGING */
+
+ Lisp_Object total[] = {
+ list4 (Qconses, make_fixnum (sizeof (struct Lisp_Cons)),
+ make_int (gcstat.total_conses),
+ make_int (gcstat.total_free_conses)),
+ list4 (Qsymbols, make_fixnum (sizeof (struct Lisp_Symbol)),
+ make_int (gcstat.total_symbols),
+ make_int (gcstat.total_free_symbols)),
+ list4 (Qstrings, make_fixnum (sizeof (struct Lisp_String)),
+ make_int (gcstat.total_strings),
+ make_int (gcstat.total_free_strings)),
+ list3 (Qstring_bytes, make_fixnum (1),
+ make_int (gcstat.total_string_bytes)),
+ list3 (Qvectors,
+ make_fixnum (header_size + sizeof (Lisp_Object)),
+ make_int (gcstat.total_vectors)),
+ list4 (Qvector_slots, make_fixnum (word_size),
+ make_int (gcstat.total_vector_slots),
+ make_int (gcstat.total_free_vector_slots)),
+ list4 (Qfloats, make_fixnum (sizeof (struct Lisp_Float)),
+ make_int (gcstat.total_floats),
+ make_int (gcstat.total_free_floats)),
+ list4 (Qintervals, make_fixnum (sizeof (struct interval)),
+ make_int (gcstat.total_intervals),
+ make_int (gcstat.total_free_intervals)),
+ list3 (Qbuffers, make_fixnum (sizeof (struct buffer)),
+ make_int (gcstat.total_buffers)),
+
+#ifdef DOUG_LEA_MALLOC
+ list4 (Qheap, make_fixnum (1024),
+ make_int ((mallinfo ().uordblks + 1023) >> 10),
+ make_int ((mallinfo ().fordblks + 1023) >> 10)),
+#endif
+ };
+
+ Lisp_Object val = CALLMANY (Flist, total);
+ Lisp_Object string = Fprin1_to_string (val, Qnil);
+ char *char_string = SSDATA (string);
+ fprintf (stderr, "%s\n", char_string);
+
+/* end DEBUGGING */
+/* *************************************************************************** */
+
+
/* GC is complete: now we can run our finalizer callbacks. */
run_finalizers (&doomed_finalizers);
next reply other threads:[~2019-04-13 5:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-13 5:55 Keith David Bershatsky [this message]
2019-04-13 6:48 ` NS port: How to debug excessive garbage collection? Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2019-04-16 5:51 Keith David Bershatsky
2019-04-16 2:57 Keith David Bershatsky
2019-04-16 5:26 ` Alex Gramiak
2019-04-15 5:19 Keith David Bershatsky
2019-04-15 2:55 Keith David Bershatsky
2019-04-15 3:44 ` Alex Gramiak
2019-04-14 19:46 Keith David Bershatsky
2019-04-14 23:31 ` Alex Gramiak
2019-04-14 7:41 Keith David Bershatsky
2019-04-13 18:07 Keith David Bershatsky
2019-04-13 21:41 ` Alex Gramiak
2019-04-14 3:47 ` Daniel Colascione
2019-04-13 16:31 Keith David Bershatsky
2019-04-13 17:02 ` Alex Gramiak
2019-04-11 23:04 Keith David Bershatsky
2019-04-12 9:30 ` Eli Zaretskii
2019-04-11 3:27 Keith David Bershatsky
2019-04-11 14:14 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m28swejvoh.wl%esq@lawlist.com \
--to=esq@lawlist.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.