zeroshade commented on issue #70: URL: https://github.com/apache/arrow-go/issues/70#issuecomment-4683530507
Closing as mitigated. The concrete action item from this discussion — providing a malloc-based allocator so buffers can be allocated in C memory (and thus legally referenced from C-allocated structures across the C Data Interface) — was delivered as the `mallocator` (originally apache/arrow#33902, now living here at `arrow/memory/mallocator` plus `arrow/memory/default_mallocator.go`). Code that needs to export Arrow data over the C Data Interface in strict compliance with the cgo pointer rules can allocate with the mallocator. The remaining "default `GoAllocator` technically stores a Go pointer in C memory" behavior is a deliberate, documented tradeoff: we keep the Go `ArrayData` alive via a `cgo.Handle` in `private_data`, which is safe in practice given Go's non-moving GC. Enforcing strict compliance universally (e.g. a per-`Buffer` "safe to export" flag with export-time checks) would require breaking the `Allocator` interface for limited practical benefit, so we are not pursuing it. If a future runtime change makes the non-moving-GC assumption unsafe, or someone wants to contribute the buffer-safety-flag enforcement, we can revisit in a fresh issue. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
