tracee icon indicating copy to clipboard operation
tracee copied to clipboard

miss makezero in slice init

Open alingse opened this issue 8 months ago • 1 comments

I was running github actions to run linter makezero for top github golang repos.

see issues https://github.com/alingse/go-linter-runner/issues/1

and the github actions output https://github.com/alingse/go-linter-runner/actions/runs/9242979001/job/25426506045

====================================================================================================
append to slice `res` with non-zero initialized length at https://github.com/aquasecurity/tracee/blob/main/pkg/bufferdecoder/eventsreader.go#L384:[9](https://github.com/alingse/go-linter-runner/actions/runs/9242979001/job/25426506045#step:4:10)
====================================================================================================

the res := make([]byte, max) should be res := make([]byte, 0, max)

the origin way is no help to optimize memory allocation, the append still cause an extra allocation

alingse avatar May 27 '24 15:05 alingse