ShaiviAgarwal2 commented on issue #36360:
URL: https://github.com/apache/arrow/issues/36360#issuecomment-1809944361
@felipecrv
The enhancement requested is to improve the code by making it easier to see
when a function is using the default memory pool instead of the intended memory
pool. This is done by changing the internal functions to not define
`default_memory_pool()` as the default argument and changing the callsites to
explicitly pass the intended memory pool. Additionally, functions that call
`default_memory_pool()` should be changed to take a `MemoryPool * `parameter
instead.
```
void myFunction(int arg1, int arg2, MemoryPool *pool =
default_memory_pool()) {
// function implementation using pool instead of default_memory_pool()
}
// Updated version:
void myFunction(int arg1, int arg2, MemoryPool *pool) {
// function implementation using pool instead of default_memory_pool()
}
// Call site before update:
myFunction(arg1, arg2);
// Updated call site:
MemoryPool *pool = getMemoryPool(); // get the intended memory pool
myFunction(arg1, arg2, pool);
```
--
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]