-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Conversation
related: #56641
When I performed the same memray inspection on the latest version that includes both fixes, the first issue was clearly resolved, but the second issue still persists.
memray1.html
When a Client object is created, ctx = ssl.create_default_context(cafile=ca_file) continues to be executed repeatedly, which accumulates in memory and causes a memory leak. (It appears to be allocated as a C language object and remains in memory regardless of Python object GC)
This PR uses caching to prevent the SSL context object from being recreated.
Here are the results after running for two hours with this change. The memory usage, which was previously growing to tens of MBs, now stabilizes at approximately 700KB.
memray2.html
(cherry picked from commit 7369e46)
Co-authored-by: Jeongwoo Do 48639483+wjddn279@users.noreply.github.com
When I performed the same memray inspection on the latest version that includes both fixes, the first issue was clearly resolved, but the second issue still persists.
[memray1.html](https://github.com/user-attachments/files/23160226/memray1.html)
When a Client object is created, `ctx = ssl.create_default_context(cafile=ca_file)` continues to be executed repeatedly, which accumulates in memory and causes a memory leak. (It appears to be allocated as a C language object and remains in memory regardless of Python object GC)
This PR uses caching to prevent the SSL context object from being recreated.
Here are the results after running for two hours with this change. The memory usage, which was previously growing to tens of MBs, now stabilizes at approximately 700KB.
[memray2.html](https://github.com/user-attachments/files/23160405/memray2.html)
(cherry picked from commit 7369e46)
Co-authored-by: Jeongwoo Do <48639483+wjddn279@users.noreply.github.com>