felipecrv opened a new issue, #36360:
URL: https://github.com/apache/arrow/issues/36360

   ### Describe the enhancement requested
   
   Default argument values are convenient, but create implicit uses that are 
hard to see by simply scanning code at function callsites.
   
   Function that accept a `MemoryPool *` should (ideally) only call functions 
that perform allocations with that memory pool. Due to many functions being 
declared with `MemoryPool *pool = default_memory_pool()`, it's very easy to 
accidentally use the default memory pool when you should be passing down the 
memory pool you received.
   
   Fixing this issue has two steps:
   
   1) Changing internal functions to not define `default_memory_pool()` as 
default argument and changing the callsites to pass a memory pool they receive 
from callers of explicitly pass the `default_memory_pool()`.
   
   2) Change declarations of functions that call `default_memory_pool()` to 
take a `MemoryPool *` parameter instead. Then go to step 1 again.
   
   Related issues:
    - #36293
    - #34025
   
   ### Component(s)
   
   C++


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