Comments (4)
Hi @sluongng !
The library would call Close
automatically when an object becomes unreachable and deallocated by go's garbage collector. To do this we are using runtime.SetFinalizer.
The important line from the documentation:
The finalizer is scheduled to run at some arbitrary time after the program can no longer reach the object to which obj points.
Because cleaning doesn't happen immediately when you process a lot of data you might run out of memory or your program will just consume more memory than desired. For such use cases, we export Close
method so that developers have more control and can optimize deallocation.
For most use cases, though, it is not necessary, GC and go runtime will do the job just fine.
Does it answer your question?
from go-tree-sitter.
Ah thanks, that clarified things quite a lot.
I would suggest providing this information as part of the API doc. 🙏
from go-tree-sitter.
Agree. I will be happy to accept a pull request with improved documentation!
from go-tree-sitter.
Closed with #71
from go-tree-sitter.
Related Issues (20)
- Lua parser does not compile on current master HOT 1
- go mod error HOT 1
- Upstreaming generation of bindings HOT 6
- Update javascript grammer
- Unable to build for windows HOT 6
- How can I support Objective-C and Swift? HOT 1
- صباح HOT 1
- add vue
- ld: library not found for -lcrt0.o for python
- Cannot build library with MacOS HOT 1
- Grammar update script not working HOT 1
- Panic when parsing C++ code in tree-sitter > 0.20.0 HOT 3
- Why do I need to call FilterPredicates to apply the predicates?
- An error occurred when parsing the JS file
- Tags support? HOT 1
- Querying does not always work as it should HOT 1
- parse c is oom, please take a look. HOT 1
- Missing typescript module HOT 1
- Suggested update for Custom grammars section in the README
- Child and ChildCount use different different types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-tree-sitter.