AsyncStream 内存泄漏
Hi, I’m encountering an issue with the send function of the ResponseStream in my application. The goal is to stream images to a web page, and while it works correctly at first, I’ve noticed that over time the RAM usage gradually increases (by several MB every few seconds). Interestingly, this problem seems to be linked to network speed or buffer buildup. If I increase the pause between sending images, the memory increase slows down or disappears. Additionally, sending smaller payloads prevents the issue entirely. When testing on a gigabit Ethernet connection, the problem doesn’t occur, but it becomes noticeable when using slower connections, such as a 4G SIM network. It seems like the data is not being consumed fast enough on slower networks, leading to memory buildup. Could this be related to how the internal buffer is managed within the ResponseStream? Any guidance on how to handle this situation or optimize the streaming process would be greatly appreciated.
内容来源: drogonframework/drogon