[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node
From: |
Stefan Monnier |
Subject: |
bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node |
Date: |
Wed, 08 Mar 2023 11:34:14 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> I tried cargo-culting the cpu_gc_count stuff for the memory profiler,
> see the patch below. However, something is amiss: this assertion in
> profiler.el sometimes triggers:
>
> (maphash
> (lambda (backtrace _count)
> (let* ((max (1- (length backtrace)))
> (head (aref backtrace max))
> (best-parent nil)
> (best-match (1+ max))
> (parents (gethash head fun-map)))
> (pcase-dolist (`(,i . ,parent) parents)
> (when t ;; (<= (- max i) best-match) ;Else, it can't be better.
> (let ((match max)
> (imatch i))
> (cl-assert (>= match imatch)) <<<<<<<<<<<<<<<<<<<<<<<<<<<<
> (cl-assert (function-equal (aref backtrace max)
> (aref parent i)))
>
> I cannot reliably reproduce this, and don't understand what causes the
> assertion. Any hints?
Hmm... I just took a look but can't see neither why your change would
be more likely to trigger this error than the existing code for the
`cpu` case, nor why this assertion should always be true.
IOW, I'm going to have to find the original author to ask him what he
was thinking back then.
> Here's the patch:
Looks good. Just one nitpick:
> malloc_probe (size_t size)
> {
> if (EQ (backtrace_top_function (), QAutomatic_GC)) /* bug#60237 */
> - /* FIXME: We should do something like what we did with `cpu_gc_count`.
> */
> - return;
> - eassert (HASH_TABLE_P (memory_log));
> - record_backtrace (XHASH_TABLE (memory_log), min (size,
> MOST_POSITIVE_FIXNUM));
> + /* Special case the malloc-count inside GC because the hash-table
> + code is not prepared to be used while the GC is running.
> + More specifically it uses ASIZE at many places where it does
> + not expect the ARRAY_MARK_FLAG to be set. We could try and
> + harden the hash-table code, but it doesn't seem worth the
> + effort. */
> + mem_gc_count = saturated_add (mem_gc_count, 1);
Here we should increase by `size` rather than by 1.
Stefan
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Eli Zaretskii, 2023/03/01
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/01
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Eli Zaretskii, 2023/03/01
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/01
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Eli Zaretskii, 2023/03/04
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node,
Stefan Monnier <=
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/10
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/10
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Eli Zaretskii, 2023/03/11
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/11
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Po Lu, 2023/03/10
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/10
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Po Lu, 2023/03/10
- bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Stefan Monnier, 2023/03/10
bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node, Po Lu, 2023/03/02