Basic checks
What's broken?
When passing in a large PDF, faraday and pretty print use a significant amount of memory for logging. When running a memory profile, you can see below that faraday and pp use 66MB of memory:
allocated memory by gem (bytes)
-----------------------------------
33451488 pp-0.6.3
33414027 faraday-2.14.0
However, if I disable body logging for faraday, that drops to a negligible amount:
allocated memory by gem (bytes)
-----------------------------------
113466 faraday-2.14.0
1176 pp-0.6.3
How to reproduce
- Create an ActiveStorage object for a large PDF
- Call OpenAI with that PDF
Expected behavior
This logging should not take such a large amount of memory.
What actually happened
Logging uses a significant amount of memory (over 10x the size of the PDF)
Environment
- Ruby version: 3.4.2
- RubyLLM version: 1.9.1
- Provider: OpenAI
Basic checks
What's broken?
When passing in a large PDF, faraday and pretty print use a significant amount of memory for logging. When running a memory profile, you can see below that faraday and pp use 66MB of memory:
However, if I disable body logging for faraday, that drops to a negligible amount:
How to reproduce
Expected behavior
This logging should not take such a large amount of memory.
What actually happened
Logging uses a significant amount of memory (over 10x the size of the PDF)
Environment