<- Back | Index | Forward ->
Reference Counting
Reference counted object contain an extra term, the count.
- Starts at 1,
- Increment by 1 when needed by something else,
- Decrement by 1 when no longer needed,
- Destructor (__del__) called when the count goes to 0.
Daylight object handles which must be dt_dealloc'ed are stored in a
"smart_ptr" class.
- These objects are reference counted,
- __del__ calls dt_dealloc(self.handle)
- It "acts" like a standard (integer) handle
- the __int__ method returns self.handle,
- integers and smart_ptrs are treated the same by DaySWIG.
Using the smart_ptr class means Python manages nearly every call to
dt_dealloc.