[go-nuts] Re: Attaching a Finalizer to a struct field holding a slice or the slice's underlying array

2019-12-29 Thread 'Keith Randall' via golang-nuts
It should work to just set the finalizer on the first byte of an allocation. i.e.: s := make([]byte, N) runtime.SetFinalizer(&s[0], func(b *byte) { ... }) Note that the spec of runtime.SetFinalizer doesn't actually guarantee that this will work. But I think in the current implementation it will

Re: [go-nuts] Re: net.conn TCP connection

2019-12-29 Thread Robert Engels
Use read and expand the buffer as needed (or write the chunks to a file). If at the end it is all going to be in memory, you might as well start with the very large buffer. There is nothing special about Go in this regard - it’s standard IO processing. > On Dec 29, 2019, at 9:21 AM, Ron Wahler

Re: [go-nuts] Simple worker pool in golnag

2019-12-29 Thread Robert Engels
I agree. I meant that worker pools are especially useful when you can do cpu affinity - doesn’t apply to Go. I think Go probably needs some idea of “capping” for cpu based workloads. You can cap in the local N CPUs , but in a larger app that has multiple parallel processing points you can easy

[go-nuts] Re: net.conn TCP connection

2019-12-29 Thread Ron Wahler
Jake, Thanks for the reply. Csrc.Read is what I was referring to as the connection standard read, should not have used the words "standard read" sorry about that. The problem I am trying to solve is reading an unknown amount of byte data. I am trying to understand what triggers the Csrc.Read(