Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive memory usage when generating multiple fakes with counterfeiter:generate directives. #254

Open
silvestre opened this issue Aug 18, 2023 · 0 comments

Comments

@silvestre
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant