mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
When using Minio storage, memory usage constantly increases. After profiling, it appears that memory usage is building in the minio client, and not being released. Finding a similar issue listed in the minio/warp project, I found that they fixed the issue by closing the *minio.Object instances. In the athens usage, the minio.Object instances are never closed after reading the data from them. This adds deferred 'Close' calls in the 'storageImpl.Info' and 'storageImpl.GoMod' functions so that the objects may be released and garbage collected. The 'storageImpl.Zip' function does not use defer, since it has the object embedded into the return value, so the 'Close' is only called on error.