CurtHagenlocher commented on code in PR #329: URL: https://github.com/apache/arrow-dotnet/pull/329#discussion_r3143610121
########## src/Apache.Arrow.Scalars/Variant/Buffer.cs: ########## @@ -0,0 +1,213 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Buffers; +using System.Buffers.Binary; +using System.Collections.Generic; + +namespace Apache.Arrow.Scalars.Variant +{ + /// <summary> + /// Mutable, non-thread-safe growable buffer designed for single-owner use as + /// a field on a class (or as a local owned by the same method that created + /// it). The backing array is rented from a caller-supplied + /// <see cref="Stack{T}"/> so that capacity is "sticky" across reuse cycles + /// within one owner — unlike <see cref="ArrayPool{T}.Shared"/>, which + /// buckets by size class and may hand back a different array than the one + /// last returned. + /// </summary> Review Comment: Thanks! This got me to realize that the arrays being rented in `Buffer` but returned in `VariantValueWriter` was unsatisfying if not actively dangerous. I've moved the drainage code to `Buffer` and added a comment. -- 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]
