The golang bindings currently use finalizers to manage native resources. From what I understand, this has some downsides mainly related to the fact that there aren’t strong guarantees around when finalizers will be run. It sounds like one particular issue that may arise is when there is a large quantity of native memory that needs to be freed but an absence of memory pressure in Go. This can result in garbage collection (and the finalizers) not being run, preventing the release of native resources.
The Java bindings have similar concerns, and they address them by providing methods to explicitly close native resources. I’m not an expert with Go, but I’m wondering if we should do the same thing there. Are there any Go users here that have opinions on this?