go-zmq icon indicating copy to clipboard operation
go-zmq copied to clipboard

Possible memory leak PUB/SUB

Open Arhius opened this issue 7 years ago • 0 comments

Hello I have an issue with pub/sub model. I have one publisher that binds to ip:5556 and 4 workers(subs) that connects to ip:5556. Publisher After few hour of test work the usage of used memory increased. Can You please recommend me how can I solve such problem? Maybe used other zmq model My publisher code zmqContext, _ := zmq.NewContext() pub, _ := zmqContext.Socket(zmq.Pub) defer pub.Close() pub.Bind(fmt.Sprintf("tcp://%s:5556", *ip))

pubChan := pub.Channels()
defer pubChan.Close()
   ...
   ...
if *isSync {
	go func() {
		b.pub.Out() <- [][]byte{[]byte(*ip), []byte(fmt.Sprintf("%d|%s|%s", group.Id, link, gl))}
	}()
}

Arhius avatar May 23 '17 18:05 Arhius