Declow commented on issue #2325:
URL: 
https://github.com/apache/iceberg-python/issues/2325#issuecomment-3183215772

   I think I found the root cause.
   If we only print the avro/reader
   ```
       for i in range(1000):
           df = generate_df()
           df.write_iceberg(table, mode="append")
           snapshot = tracemalloc.take_snapshot()
           top_stats = snapshot.statistics("lineno")
           print(i)
           for stat in top_stats:
               if "avro/reader" in str(stat):
                   print(stat)
   ```
   
   In manifest.py a cache is set 
https://github.com/apache/iceberg-python/blob/main/pyiceberg/manifest.py#L878
   If I set this to 1 the following will always increase but by a very tiny 
amount 200 byte per write.
   
   > 
/Users/dits/git/play-recommendation-input-consumer/.venv/lib/python3.11/site-packages/pyiceberg/avro/reader.py:322:
 size=1464 B, count=23, average=64 B
   > 
/Users/dits/git/play-recommendation-input-consumer/.venv/lib/python3.11/site-packages/pyiceberg/avro/reader.py:372:
 size=728 B, count=13, average=56 B
   > 
/Users/dits/git/play-recommendation-input-consumer/.venv/lib/python3.11/site-packages/pyiceberg/avro/reader.py:295:
 size=620 B, count=1, average=620 B
   > 
/Users/dits/git/play-recommendation-input-consumer/.venv/lib/python3.11/site-packages/pyiceberg/avro/reader.py:453:
 size=590 B, count=1, average=590 B
   
   The higher the max cache value the faster the memory increases.
   
   If I remove the cache altogether the memory will be released correctly no 
matter the amount of iterations.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to