GNU bug report logs - #58596
29.0.50; [PATCH] Fix memory leak when loading Tree-sitter language definitions

Previous Next

Package: emacs;

Reported by: Daniel Martín <mardani29 <at> yahoo.es>

Date: Mon, 17 Oct 2022 22:56:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Daniel Martín <mardani29 <at> yahoo.es>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Daniel Martín <mardani29 <at> yahoo.es>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] Fix memory leak when loading Tree-sitter language
 definitions
Date: Tue, 18 Oct 2022 00:54:57 +0200
[Message part 1 (text/plain, inline)]
I'm instrumenting the Tree-sitter branch to make sure there's no glaring
memory issues like leaks or undefined behavior.  I've found that the
function treesit_load_language leaks a few bytes each time a language is
loaded.

To fix the bug, I've simplified a bit the logic that loads the dynamic
library, to avoid the string duplication that was leaking, and removed a
loop that I think it's not really necessary (that'll save us a few CPU
cycles).

Please check that I've not made any crucial mistake, and feel free to
merge it if you think it's a good patch.

Thanks.

[0001-Fix-memory-leak-when-loading-Tree-sitter-language-de.patch (text/x-patch, attachment)]

This bug report was last modified 2 years and 205 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.