rok commented on code in PR #13516:
URL: https://github.com/apache/arrow/pull/13516#discussion_r967016471


##########
cpp/src/arrow/memory_pool.h:
##########
@@ -175,6 +176,25 @@ ARROW_EXPORT Status jemalloc_memory_pool(MemoryPool** out);
 ARROW_EXPORT
 Status jemalloc_set_decay_ms(int ms);
 
+/// \brief Get basic allocation statistics from jemalloc
+/// See the MALLCTL NAMESPACE section in jemalloc project documentation for
+/// available stats.
+Status jemalloc_get_stat(const char* name, size_t& out);
+Status jemalloc_get_stat(const char* name, uint64_t& out);

Review Comment:
   The issue here is that jemalloc's `mallctl` interface takes either `size_t`, 
`uint64_t` or `uint64_t*` depending on the `name` parameter. E.g.:
   ```
   stats.allocated (size_t) r- [--enable-stats]
   Total number of bytes allocated by the application.
   
   thread.allocated (uint64_t) r- [--enable-stats]
   Get the total number of bytes ever allocated by the calling thread. This 
counter has the potential to wrap around; it is up to the application to 
appropriately interpret the counter in such cases.
   
   thread.allocatedp (uint64_t *) r- [--enable-stats]
   Get a pointer to the the value that is returned by the 
[thread.allocated](http://jemalloc.net/jemalloc.3.html#thread.allocated) 
mallctl. This is useful for avoiding the overhead of repeated mallctl*() calls. 
Note that the underlying counter should not be modified by the application.
   ```
   
   If `Result<int64_t> jemalloc_get_stat(const char* name);`-like interface is 
ok I'd move to it.



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