You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current buffer pool appears to buffer writes for HTML templating. While the buffers are Reset upon resubmission to the pool, this doesn't free the underlying memory. The result in a long running web server is that the buffer pool contains ~64 * the largest template rendered.
This size can get unreasonable in applications like Gitea where some pages might contain sizable assets like pictures. My heap profiles show something like 500MiB of heap space just because of this.
Possible solutions
This buffer pool probably isn't needed at all. Simply push the concern of write buffering to the calling library. In fact, the most likely writer to be used with this library already buffers writes: http.ResponseWriter.
If a buffer pool is really needed, perhaps use something like this sized buffer pool that trims down buffers that grow past a certain size so that the pool can't grow unchecked.
The text was updated successfully, but these errors were encountered:
Problem
The current buffer pool appears to buffer writes for HTML templating. While the buffers are
Reset
upon resubmission to the pool, this doesn't free the underlying memory. The result in a long running web server is that the buffer pool contains ~64 * the largest template rendered.This size can get unreasonable in applications like Gitea where some pages might contain sizable assets like pictures. My heap profiles show something like 500MiB of heap space just because of this.
Possible solutions
This buffer pool probably isn't needed at all. Simply push the concern of write buffering to the calling library. In fact, the most likely writer to be used with this library already buffers writes:
http.ResponseWriter
.If a buffer pool is really needed, perhaps use something like this sized buffer pool that trims down buffers that grow past a certain size so that the pool can't grow unchecked.
The text was updated successfully, but these errors were encountered: