merlimat commented on a change in pull request #8325:
URL: https://github.com/apache/pulsar/pull/8325#discussion_r510272691



##########
File path: pulsar-client-go/pulsar/c_producer.go
##########
@@ -298,6 +298,7 @@ func pulsarProducerSendCallbackProxyWithMsgID(res 
C.pulsar_result, messageId *C.
                sendCallback.callback(getMessageId(messageId), newError(res, 
"Failed to send message"))
        } else {
                sendCallback.callback(getMessageId(messageId), nil)
+               C.pulsar_message_id_free(messageId)

Review comment:
       @bschofield I think this free should not be done, because 
`getMessageId(messageId)` is already attaching a finalizer to the Go object and 
it will free the message id automatically:
   
   ```
   func getMessageId(messageId *C.pulsar_message_id_t) MessageID {
        msgId := &messageID{ptr: messageId}
        runtime.SetFinalizer(msgId, messageIdFinalizer)
        return msgId
   }
   ```

##########
File path: pulsar-client-go/pulsar/c_producer.go
##########
@@ -298,6 +298,7 @@ func pulsarProducerSendCallbackProxyWithMsgID(res 
C.pulsar_result, messageId *C.
                sendCallback.callback(getMessageId(messageId), newError(res, 
"Failed to send message"))
        } else {
                sendCallback.callback(getMessageId(messageId), nil)
+               C.pulsar_message_id_free(messageId)

Review comment:
       @bschofield I think this free should not be done, because 
`getMessageId(messageId)` is already attaching a finalizer to the Go object and 
it will free the message id automatically:
   
   ```go
   func getMessageId(messageId *C.pulsar_message_id_t) MessageID {
        msgId := &messageID{ptr: messageId}
        runtime.SetFinalizer(msgId, messageIdFinalizer)
        return msgId
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to