1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-19 09:40:23 +08:00

optimize: memory consumption

This commit is contained in:
源文雨
2025-05-13 00:59:05 +09:00
parent d65fc4dd71
commit df8f6affa3
19 changed files with 204 additions and 242 deletions

View File

@@ -12,6 +12,10 @@ import (
var packetPool = pbuf.NewBufferPool[Packet]()
func init() {
packetPool.LimitInput(256)
packetPool.LimitOutput(256)
pbuf.LimitInput(256)
pbuf.LimitOutput(256)
if config.ShowDebugLog {
go status()
}
@@ -23,7 +27,7 @@ func selectPacket(buf ...byte) *PacketItem {
}
func status() {
for range time.NewTicker(time.Minute).C {
for range time.NewTicker(time.Second).C {
out, in := packetPool.CountItems()
logrus.Infoln(file.Header(), "packet outside:", out, "inside:", in)
out, in = pbuf.CountItems()