mirror of
https://github.com/rclone/rclone.git
synced 2025-03-17 20:27:52 +02:00
This changes crypt's use of sync.Pool: Instead of storing slices it now stores pointers pointers fixed sized arrays. This issue was reported by staticcheck: SA6002 - Storing non-pointer values in sync.Pool allocates memory A sync.Pool is used to avoid unnecessary allocations and reduce the amount of work the garbage collector has to do. When passing a value that is not a pointer to a function that accepts an interface, the value needs to be placed on the heap, which means an additional allocation. Slices are a common thing to put in sync.Pools, and they're structs with 3 fields (length, capacity, and a pointer to an array). In order to avoid the extra allocation, one should store a pointer to the slice instead. See: https://staticcheck.io/docs/checks#SA6002