Subject: Re: bug#71012: 30.0.50; tree-sitter crash

From: "Basil L. Contovounesios" <[email-masked]>
Date: Thu, 13 Jun 2024 13:43:23 +0200

Yuan Fu [2024-06-11 22:38 -0700] wrote:

>> On Jun 7, 2024, at 1:39 AM, Basil L. Contovounesios <[email-masked]> wrote:
>> 
>> Just curious: since generate-new-buffer creates a new buffer each time
>> it is called, is it guaranteed that this buffer will eventually be GCed,
>> once the caller of treesit-parse-string is done with it?
>
> Yeah, from my testing that seems to be the case.

What did you try?
I'm putting the following in an emacs -Q *scratch* buffer:

  (require 'treesit)
  (message "# of buffers before : %d" (length (buffer-list)))
  (dotimes-with-progress-reporter (i 10000) "Parsing"
    (treesit-parse-string "int c = 0;" 'c))
  (garbage-collect)
  (message "# of buffers after  : %d" (length (buffer-list)))

Each time I M-x eval-buffer:
- the list of buffers grows
- the memory usage grows
- loop iterations slow down noticeably

Am I missing something?

-- 
Basil