-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in Receive methods #53
Comments
Hi @zemlya25 - good spot, thank you. There looks to be an equivalent opportunity for a leak when Sending messages based on calls to |
There are also leaks here, Especially when the message is not available |
Basic testing using the Mac activity monitor to check the total process size when running a test;
Remaining test to validate during send + receive activity before merging. |
TestLeakOnPutGet
|
great news! thanx |
checked an issue and fix. Works great! |
great, thanks for confirming @zemlya25 - please do feel free to raise any other issues you may find! |
@matrober-uk do you have any plans on next release version with implemented fixes? |
Hi @zemlya25 - no time like the present :-) I've just created a new v1.10.0 release here which includes these memory leak fixes |
Hi, @matrober-uk
I've realized that current implementation of Receive* methods cause memory leakage. It can't be detected with pprof because of CGO
500mb on 100k received message
Little investigation below, Can prepare PR
func (consumer ConsumerImpl) receiveInternal(gmo *ibmmq.MQGMO)
returns TextMessageImpl/BytesMessageImpl with thisMessageHandle *ibmmq.MQMessageHandle
// Include the message properties in the msgHandle gmo.Options |= ibmmq.MQGMO_PROPERTIES_IN_HANDLE cmho := ibmmq.NewMQCMHO() **thisMsgHandle, _ := consumer.ctx.qMgr.CrtMH(cmho)** gmo.MsgHandle = thisMsgHandle ... msg = &TextMessageImpl{ bodyStr: msgBodyStr, MessageImpl: MessageImpl{ mqmd: getmqmd, **msgHandle: &thisMsgHandle,** }, }
and it should be closed/deleted with msgHandle.DltMH(ibmmq.NewMQDMHO()) after message has been processed
`// Delete message handler
func (msg *MessageImpl) CleanMH() jms20subset.JMSException {
if msg.msgHandle == nil {
return jms20subset.CreateJMSException("EmptyMessageHandler", "EmptyMessageHandler", nil)
}
}
`
The text was updated successfully, but these errors were encountered: