GitHub user adamreeve added a comment to the discussion: Proposal: Pluggable 
allocator API

Thanks for putting this together Curt. I think this would be a great 
improvement and fix some real rough edges with the library.
The proposed approach seems sound to me, from the description and a quick skim 
of #504.

My thoughts on the discussion questions:

> 1. **Disposable builders:** is making builders `IDisposable` acceptable? Code 
> analysis users with CA2000 enabled may start seeing warnings on builders they 
> never disposed. Should `IArrowArrayBuilder` stay as it is?

I think the proposed approach is the right solution. Making 
`IArrowArrayBuilder` `IDisposable` would be too much of a breaking change, I 
don't think that could be done even with a major release due to it breaking the 
ABI. But making existing builders `IDisposable` seems OK. `(builder as 
IDisposable)?.Dispose()` is pretty easy to do, but this should be clearly 
documented.

> 2. **Defaults and #397:** should a future major release change the default 
> allocator? For example, it could become `ManagedMemoryAllocator`, or arrays 
> on the pinned object heap, which are rooted by the GC, aligned and never 
> move. Or should the default stay native, with fixes like this one targeted at 
> specific cases?

I think `ManagedMemoryAllocator` would be the right default if starting from 
scratch. Changing the default now seems like a pretty big change, but it should 
be ABI compatible, and maybe this is worth doing. One complication would be the 
alignment issue you point out in #267, but I think that's acceptable.

> 3. **Hand-over contract:** is throwing after the built buffer is disposed the 
> right trade-off, compared with leaking or always copying?

I think this is the right approach. This doesn't break any existing code unless 
switching to one of the new allocator lifetimes, if I've understood correctly.

> 4. **Separate temporary and long-term allocators:** internally a builder 
> already pairs an allocator for working memory with one for the result. Should 
> that pairing be public, for example on `ArrowContext`?

I can imagine this could be useful, but it seems like it could be added later 
as a non-breaking change if there's demand for it? Which gives a bit more 
flexibility if we want to change things before shipping that feature.

> 5. **Naming:** are `AllocationLifetime` and its values, 
> `CallerOwnedNativeAllocator`, `PooledManagedAllocator` and 
> `ManagedMemoryAllocator` the right names?

One suggestion is changing `AllocationLifetime.CallerOwned` to 
`AllocationLifetime.Disposed`, which seems more aligned with how the other two 
are defined, and a bit more intuitive to me. But `CallerOwnedNativeAllocator` 
should probably keep its current name.

> 6. **`FlightClient.Create`:** this unreleased method is now redundant with 
> the new constructor. Should it be removed before it ships?

I would say yes, it's better if there's just one way to do things unless 
there's a good reason to provide this alternative.

> 7. **The new Flight dependency:** is the dependency on 
> `Microsoft.Extensions.DependencyInjection.Abstractions` acceptable?

Seems reasonable to me.

GitHub link: 
https://github.com/apache/arrow-dotnet/discussions/509#discussioncomment-19762685

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to