[go-nuts] Re: Garbage Collector triggering when deleting an object

2020-11-22 Thread tokers
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.

Re: [go-nuts] detecting cyclic references

2020-11-22 Thread arpad ryszka
Thanks a lot for the help! Seems like I could sort it out based on the reflect.DeepEqual code. Do you have any testing tips? Out of general curiosity, I am wondering why the type is part of the key for the visited map here: https://golang.org/src/reflect/deepequal.go#L15. If I remove it, the te

Re: [go-nuts] Garbage Collector triggering when deleting an object

2020-11-22 Thread Robert Engels
Read about Go finalizers. > On Nov 22, 2020, at 6:13 AM, 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. > > Can I set up a trigger m

[go-nuts] Garbage Collector triggering when deleting an object

2020-11-22 Thread Sean
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. Can I set up a trigger mechanism like "x.__del__" as in Python? I can set the garbage collector to follow s

Re: [go-nuts] Casting int to bool and the reverse for bit hacking ?

2020-11-22 Thread christoph...@gmail.com
Thank you Aleksey. That is indeed a working solution, and it works well. Here are the two functions I wrote as suggested: func bool2int(b bool) int { if b { return 1 } return 0 } func testBitHack(v int) bool { return (bool2int(v==10) & bool2int(v==