tree-sitter-dart icon indicating copy to clipboard operation
tree-sitter-dart copied to clipboard

The Tree Finalizer appears to not be working.

Open modulovalue opened this issue 1 year ago • 0 comments

There seems to be a memory leak somewhere.

  • When parsing 50k files with the analyzer, the memory usage peaks at roughly 1.2 GB.

  • With tree-sitter-dart, at around file 35k, the memory usage reaches 15 GB.

  • If we remove the finalizer logic in Tree and free the memory manually:

// ...
final tree = parser.parse(program);
treeSitterApi.ts_tree_delete(tree.tree);
// ...

then tree-sitter-dart peaks at roughly 1.3 GB for all 50k files.

  • If we remove the finalizer, and we don't free memory ourselves, then at around file 35k, we reach 15 GB, so it seems like the finalizer is either not working, or something prevents it from finalizing.

modulovalue avatar Oct 18 '23 07:10 modulovalue