google / gopacket

Provides packet processing capabilities for Go
BSD 3-Clause "New" or "Revised" License
6.32k stars 1.13k forks source link

Importing gopacket and doing nothing uses 8.2MB of RES mem #692

Open randy98 opened 5 years ago

randy98 commented 5 years ago

Subject says it all. Is this by design? Makes the use of gopacket difficult in resource constrained systems.

To reproduce:

import these packages

"github.com/google/gopacket" "github.com/google/gopacket/afpacket" "github.com/google/gopacket/layers" _ "github.com/google/gopacket/pcap"

Just sleep in main. Then run htop and check RES memory.

gconnell commented 5 years ago

Known issue, caused by creating a bunch of decoder redirects and enums (mostly the stuff in enums.go, I think)? Unfortunately, not really fixable without backwards-incompatible changes. You'll probably get the same just with:

_ "github.com/google/gopacket/layers"

randy98 commented 5 years ago

Yikes! Thank you! Not sure what the norm here is. Let me know if someone will close or I should close or leave open as known issue.