This is an automated email from the ASF dual-hosted git repository.
ifplusor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-python.git
The following commit(s) were added to refs/heads/master by this push:
new 58397dc [ISSUE #96] Fix the memory leak in Message (#98)
58397dc is described below
commit 58397dc86d85d1b16a4d949c430e7499722050b5
Author: ziyht <[email protected]>
AuthorDate: Tue Oct 13 04:09:40 2020 +0800
[ISSUE #96] Fix the memory leak in Message (#98)
Message created by cpp library not released in class Message
---
rocketmq/client.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/rocketmq/client.py b/rocketmq/client.py
index 106e321..88ae128 100644
--- a/rocketmq/client.py
+++ b/rocketmq/client.py
@@ -71,6 +71,9 @@ def _to_bytes(s):
class Message(object):
def __init__(self, topic):
self._handle = dll.CreateMessage(_to_bytes(topic))
+
+ def __del__(self):
+ dll.DestroyMessage(self._handle)
def set_keys(self, keys):
ffi_check(dll.SetMessageKeys(self._handle, _to_bytes(keys)))