Skip to content

Commit

Permalink
Add __dealloc__() method to release resources
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Dec 18, 2024
1 parent ff97a43 commit 830c17b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions selfdrive/modeld/models/commonmodel_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@ cdef class DrivingModelFrame(ModelFrame):
self.frame = <cppModelFrame*>(self._frame)
self.buf_size = self._frame.buf_size

def __dealloc__(self):
del self._frame

cdef class MonitoringModelFrame(ModelFrame):
cdef cppMonitoringModelFrame * _frame

def __cinit__(self, CLContext context):
self._frame = new cppMonitoringModelFrame(context.device_id, context.context)
self.frame = <cppModelFrame*>(self._frame)
self.buf_size = self._frame.buf_size

def __dealloc__(self):
del self._frame

0 comments on commit 830c17b

Please sign in to comment.