Closed vyzo closed 5 years ago
Yeah, we could use a sync.Pool, steb made the same comment. Does it ever return memory? I am worried about hoarding memory when we scale up.
reading the docs, it explicitly mentioned that pooled objects may be gc'ed which is nice.
Yeah, it holds weak references, so unused elements are elegible for collection by the GC :-)
Added a pool.
io.Copy
uses a 32KB buffer, which as pprof indicates results in significant memory usage. This changes to usingio.CopyBuffer
directly with 4KB buffers.