Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix memory leak in gif thumbnail encoding
When using an io.Pipe, it must be ensured that the pipe is drained. If it is not, all references required for the goroutine will not be freed by the garbage collector, as an active reference still exists (the abandoned goroutine the pipe is written to. To fix this, write to a non-blocking buffer. This may increase the RAM usage in the short run, but can be fully garbage collected, even if not read from. Since the size of the buffer is at most the size of the thumbnail and it being freed quickly, this should post a significantly smaller burden on the server. Signed-off-by: Moritz Poldrack <git@moritz.sh> Fixes: 4378a4e ("Avoid use of buffers throughout thumbnailing") Fixes: t2bot#561
- Loading branch information