thisisnic commented on issue #44295:
URL: https://github.com/apache/arrow/issues/44295#issuecomment-7186557016

   Thanks for reporting this! I'm going through older bug issues to see if we 
can close them out. I used an AI agent to re-run the script above, and I've 
reviewed the results.
   
   ----------------
   
   🤖 :
   
   This doesn't look like a leak. Running the export loop above (100,000 
one-row row groups) six times in one process on pyarrow 26.0.1 (Linux, Python 
3.12), resident memory was:
   
   | | RSS |
   |---|---|
   | start | 54 MB |
   | after export 1 | 240 MB |
   | after exports 2 to 6 | 273 MB each time |
   | after `malloc_trim(0)` | 62 MB |
   
   Memory stops growing after the second export, the Arrow memory pool reports 
0 bytes after each one, and `malloc_trim(0)` returns nearly all of it to the 
OS. So the memory has been freed and is being held by the system allocator, not 
leaked. It comes from the footer metadata, which is kept for every row group 
until the file is closed and is not allocated from the Arrow pool, so 100,000 
row groups means a lot of small allocations.
   
   As found above, using larger row groups avoids it.
   
   Closing as not a bug. If you see memory that keeps growing across repeated 
exports, please open a new issue.
   


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