save-buffer commented on PR #13364:
URL: https://github.com/apache/arrow/pull/13364#issuecomment-1156511642

   A couple of thoughts: 
   - I haven't thought about garbage collecting types before - is it a big 
problem? I guess I'm not sure how often a new data type instance gets created. 
If we were worried about having lots of duplicates (e.g. someone uses 
`decimal(12, 2)` a lot instead of reusing the pointer), we could add some sort 
of interning system. Maybe this gets difficult with struct types though.
   - If we do want to garbage collect, then presumably if we went with a type 
registry for the basic types, we'd replace every instance of 
`shared_ptr<DataType>` to `DataType *`. If so, then a user of a complicated 
type could allocate it themselves and pass it around and destroy it when 
they're done, something like:
   ``` 
   std::unique_ptr<DataType> type(new MyCustomType);
   arrow::DoTheThing(type.get());
   ```


-- 
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]

Reply via email to