I'm really a go tinkerer, but I like the langauge.
I didn't realize Garbage Collection was so expensive that the goal is to only have it run 20% of the time. But its a good goal.
"Run Go application code for at least 40ms out of every 50ms."
I'm really a go tinkerer, but I like the langauge.
I didn't realize Garbage Collection was so expensive that the goal is to only have it run 20% of the time. But its a good goal.
"Run Go application code for at least 40ms out of every 50ms."
How does this work? As far as I understand Go is moving to a copying collector, so any pointers passed to C may become wild pointers when garbage collection is performed.
On go-nuts, Go's developers have been warning that passing arrays to C by getting the address of the first element of the slice will be unsafe for this reason.
I wonder, does this make stuff like this unsafe:
var thing C.thing; C.somefunc(&thing)
i.e. can stack address change now?
Create memory in Go-land
Use memory in C-land
Dispose of reference to memory in Go-land
That becomes a bit problematic if the C-land use is for a long-running process - you need a go object that owns the memory that has a lifetime that (at least) matches the lifetime of the C code execution.To make things work, you have to allocate date used in C in C and pass Go variables only by value.
it's hard. mixing manual and automatic memory management is tricky.
After all, a go executable can be 2x - 8x slower than a C one (which is still good enough for many uses).