Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The free() function crashes on Windows #62

Open
ObserverOfTime opened this issue Dec 8, 2024 · 1 comment
Open

The free() function crashes on Windows #62

ObserverOfTime opened this issue Dec 8, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ObserverOfTime
Copy link
Member

ObserverOfTime commented Dec 8, 2024

free() is used in these 3 places and it only crashes on Windows.
I don't know how to debug this, so I've disabled the calls for the time being.
This may lead to minor memory leaks but at least it won't crash.



@ObserverOfTime ObserverOfTime added bug Something isn't working help wanted Extra attention is needed labels Dec 8, 2024
@maloewe-ona
Copy link

It seems when using ts_set_allocator to specify custom allocation functions which just use the standard malloc, free, ... then the JVM does not crash, see https://github.com/maloewe-ona/java-tree-sitter/tree/windows-custom-alloc (unless I made a mistake there)

This is not really a useful workaround, but maybe it is helpful for finding the cause or it gives a hint what could be the reason? It seems somehow the default allocation functions used by tree-sitter internally are not compatible with the free function obtained through FFM on Windows. But each on their own works correctly: The default tree-sitter allocation functions work fine when tree-sitter internally allocates and frees memory, and configuring tree-sitter to only use the allocation functions through FFM (as done with the ts_set_allocator approach above) also works fine. Only the combination of memory allocated internally by tree-sitter but freed through FFM with free seems to be an issue.

I also tried to use ts_current_free instead of free but that crashes the JVM as well on Windows for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants