If you're using finalizers to clean up C memory, it's important to know
that the Go garbage collector has no understanding of how much C memory a
given resource holds. This prevents the garbage collector from making smart
decisions about when to release your resources. I've never personally seen
th
On Monday, November 23, 2020 at 6:31:50 AM UTC-5 tokers wrote:
> Are there any documents?
>
https://golang.org/pkg/runtime/#SetFinalizer
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails
Finalizers are essential in a highly concurrent system - otherwise you are
doing manual resource management with automatic memory management (a resource)
and its ugly and error prone.
Even though they are no guaranteed to be called they work very well to manage
shared resources.
> On Nov 23,
Are there any documents?
On Monday, November 23, 2020 at 7:28:31 PM UTC+8 Tamás Gulácsi wrote:
> There is a runtime.SetFinalizer, but it is not guaranteed to be run,
> anytime.
> The most idiomatic and safe solution is to have a Close() method on the Go
> side, which frees the C side.
> You may
There is a runtime.SetFinalizer, but it is not guaranteed to be run,
anytime.
The most idiomatic and safe solution is to have a Close() method on the Go
side, which frees the C side.
You may even add a Finalizer that panics if Close haven't been called
before...
tokers a következőt írta (2020.
There is a runtime.SetFinalizer function.
On Sunday, November 22, 2020 at 8:13:22 PM UTC+8 Sean wrote:
> I am writing a Golang wrapper for OpenAL-Soft.
> I need to create some buffers. These operations are happening on the
> OpenAL-Soft side (So C functions). I am loading PCM data into buffers.