Interrupting the copy_child_nodes functions can leak memory
robrix opened this issue · 1 comments
robrix commented
Because we’re using -XInterruptibleFFI
for ts_node_copy_child_nodes
(and ts_tree_cursor_copy_child_nodes
, as of #260), the runtime will interrupt the C function by killing the thread. However, these move the cursor, which allocates memory to manage the cursor’s stack; and ts_node_copy_child_nodes
allocates a cursor as well.
Thus, any time we interrupt one of these calls, we’re leaking memory, because neither of these functions installs a signal handler to clean up their allocations.