GNU bug report logs -
#71012
30.0.50; tree-sitter crash
Previous Next
Reported by: Helmut Eller <eller.helmut <at> gmail.com>
Date: Fri, 17 May 2024 13:40:01 UTC
Severity: normal
Found in version 30.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #86 received at 71012 <at> debbugs.gnu.org (full text, mbox):
> On Aug 3, 2024, at 8:01 PM, Yuan Fu <casouri <at> gmail.com> wrote:
>
>
>
>> On Jul 25, 2024, at 3:40 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>>> From: Yuan Fu <casouri <at> gmail.com>
>>> Date: Thu, 25 Jul 2024 00:26:30 -0700
>>> Cc: "Basil L. Contovounesios" <basil <at> contovou.net>,
>>> 71012 <at> debbugs.gnu.org,
>>> Helmut Eller <eller.helmut <at> gmail.com>
>>>
>>>> On Jul 24, 2024, at 10:27 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>>>
>>>>> From: "Basil L. Contovounesios" <basil <at> contovou.net>
>>>>> Cc: casouri <at> gmail.com, 71012 <at> debbugs.gnu.org, eller.helmut <at> gmail.com
>>>>> Date: Thu, 25 Jul 2024 01:32:01 +0200
>>>>>
>>>>> Eli Zaretskii [2024-07-24 19:31 +0300] wrote:
>>>>>
>>>>>>> Cc: 71012 <at> debbugs.gnu.org, eller.helmut <at> gmail.com
>>>>>>> From: "Basil L. Contovounesios" <basil <at> contovou.net>
>>>>>>> Date: Wed, 24 Jul 2024 16:57:53 +0200
>>>>>>>
>>>>>>> Ping: thoughts on whether this is an issue?
>>>>>>
>>>>>> Thoughts about what? what is deemed to be a problem in this case?
>>>>>
>>>>> That each call to treesit-parse-string now allocates a new internal
>>>>> buffer which is not automatically GCed.
>>>>>
>>>>> If this cannot be avoided, I think the docs should at least warn that
>>>>> it's the caller's responsibility to kill the return node's buffer when
>>>>> finished with it.
>>>>
>>>> If the buffers aren't killed by the code, it's indeed an issue that
>>>> needs to be solved. At the time I suggested that the node's buffer is
>>>> killed when the node is GC'ed or deleted -- have this not been done?
>>>
>>> No. I think it’s best to implement treesit-parse-string in C with ts_parse_string now. That way we don’t need to worry about the temp buffer.
>>
>> That'd be fine as well, yes.
>
> Just to update that this is taking longer than I expected. I need to change many things so the parsed tree ends up properly gc’ed. Now I remember why I used with-temp-buffer at the first place :-)
>
> Yuan
>
Ok, after much struggle I settled with the easier option, which is to still use a temp buffer, but make sure Emacs garbage collects the temp buffer. I detailed the reasoning in the comment above Ftreesit_parse_string. I verified that the buffer gets collected when the nodes are collected, and pushed it to master.
Yuan
This bug report was last modified 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.