diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-11-30 01:58:45 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-11-30 13:33:16 -0500 |
commit | 7cb71df02cbe417798067a4f68a62dcbca8be025 (patch) | |
tree | 0a556bf2d5bbd15045c3347017353bc092412002 /klippy/serialhdl.py | |
parent | 55fc11ff024958bb86331bfafc5abc11a82a48fe (diff) | |
download | kutter-7cb71df02cbe417798067a4f68a62dcbca8be025.tar.gz kutter-7cb71df02cbe417798067a4f68a62dcbca8be025.tar.xz kutter-7cb71df02cbe417798067a4f68a62dcbca8be025.zip |
mcu: Be careful to free memory allocated in C code
Free steppersync, stepcompress, and commandqueue objects.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/serialhdl.py')
-rw-r--r-- | klippy/serialhdl.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index 32b80170..7f2b9bda 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -112,8 +112,6 @@ class SerialReader: def disconnect(self): if self.serialqueue is None: return - self.send_flush() - time.sleep(0.010) self.ffi_lib.serialqueue_exit(self.serialqueue) if self.background_thread is not None: self.background_thread.join() @@ -170,7 +168,8 @@ class SerialReader: def send_flush(self): self.ffi_lib.serialqueue_flush_ready(self.serialqueue) def alloc_command_queue(self): - return self.ffi_lib.serialqueue_alloc_commandqueue() + return self.ffi_main.gc(self.ffi_lib.serialqueue_alloc_commandqueue(), + self.ffi_lib.serialqueue_free_commandqueue) # Dumping debug lists def dump_debug(self): sdata = self.ffi_main.new('struct pull_queue_message[1024]') @@ -222,6 +221,8 @@ class SerialReader: logging.info("%s: %s" % (params['#name'], params['#msg'])) def handle_default(self, params): logging.warn("got %s" % (params,)) + def __del__(self): + self.disconnect() # Class to retry sending of a query command until a given response is received class SerialRetryCommand: |