wire icon indicating copy to clipboard operation
wire copied to clipboard

Severe Memory Spike (80G+) During Code Generation Leads to Process Termination

Open yadongtan opened this issue 7 months ago • 0 comments

Describe the bug

When running wire gen on our project, the Wire process experiences uncontrolled memory growth (exceeding 80GB), eventually triggering OOM termination. This occurs during dependency graph analysis/code generation, making Wire unusable for larger projects.

Here is the pprof file when using wire. profile.pb.gz

To Reproduce

Run go build -gcflags="all=-N -l" -o wire_debug ./cmd/wire

Switch to the project directory where I need to generate code (assuming it is business_dir) Run cd ../business_dir Run ../wire/wire_debug (with Go 1.23.9 and Wire v0.6.0)

Observe memory usage via Run "go tool pprof -http=:8080 http://localhost:6060/debug/pprof/heap"

Process gets killed when reaching 80GB+ RAM

Expected behavior

Wire should complete code generation with memory usage proportional to project size (expected <10GB for our case).

Version

Wire: v0.6.0

Go: go1.23.9

OS: MacOs

Could you please help analyze this memory issue? Let me know if you need any additional information.

yadongtan avatar May 23 '25 09:05 yadongtan