Skip to content

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

@yadongtan

Description

@yadongtan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions