Excessive memory usage when generating multiple fakes with `counterfeiter:generate` directives.
silvestre opened this issue · 0 comments
silvestre commented
Hi,
generating multiple fakes using multiple counterfeiter:generate
directives uses much more memory than when generating them one by one.
Generating 23 fakes with multiple counterfeiter:generate
directives:
/bin/time -v go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
Writing `FakeWSHelper` to `fake_wshelper.go`... Done
[... 22 more fakes ...]
Writing `FakeActiveScheduleSychronizer` to `fake_sychronizer.go`... Done
Command being timed: "go run github.com/maxbrunsfeld/counterfeiter/v6 -generate"
User time (seconds): 57.21
System time (seconds): 19.67
Percent of CPU this job got: 414%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:18.54
[...]
Maximum resident set size (kbytes): 18870440
[...]
Exit status: 0
Using multiple //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6
directives:
COUNTERFEITER_NO_GENERATE_WARNING=true /usr/bin/time -v go generate .
Writing `FakeWSHelper` to `fake_wshelper.go`... Done
[... 22 more fakes ...]
Writing `FakeActiveScheduleSychronizer` to `fake_sychronizer.go`... Done
Command being timed: "go generate ."
User time (seconds): 121.57
System time (seconds): 43.26
Percent of CPU this job got: 365%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:45.13
[...]
Maximum resident set size (kbytes): 1481028
[...]
Exit status: 0
Using multiple counterfeiter:generate
directives cuts down wall clock time by more than half but increases memory usage from 1.4 GiB to 18 GiB.
Maybe there's a memory leak?
$ grep github.com/maxbrunsfeld/counterfeiter/v6 go.mod
github.com/maxbrunsfeld/counterfeiter/v6 v6.7.0