@Ahbork We have discussed adding a binding for lib/csp/src/csp_iflist.c:238 csp_iflist_remove(). This is quite simple to do, but libcsp does not offer any way to free the memory of interfaces, which may allocate some additional context driver, that may also need to be freed.
The interface (or its driver) could also be static, I which case attempting to free it would segfault.
There's a couple of ways to solve this, all of which are very likely compatible with eachother at the API level:
- I think the best would be if interfaces could register a
free() function. But this requires changes to all interface types, and to upstream; a lot of work.
- Alternatively we just don't free the interface. Python
Interface instances would remain valid, and an Interface.csp_iflist_add() could be added, so they could be registered again. But if all Python references to the csp_iface_t are lost, we would leak the memory. Nevertheless, this is probably my preferred initial solution.
- We could also have Python maintain a list of all interfaces it has ever removed, so that the references are never truly lost. But I don't see an issue in adding this later.
@Ahbork We have discussed adding a binding for
lib/csp/src/csp_iflist.c:238csp_iflist_remove(). This is quite simple to do, butlibcspdoes not offer any way to free the memory of interfaces, which may allocate some additional context driver, that may also need to be freed.The interface (or its driver) could also be static, I which case attempting to free it would segfault.
There's a couple of ways to solve this, all of which are very likely compatible with eachother at the API level:
free()function. But this requires changes to all interface types, and to upstream; a lot of work.Interfaceinstances would remain valid, and anInterface.csp_iflist_add()could be added, so they could be registered again. But if all Python references to thecsp_iface_tare lost, we would leak the memory. Nevertheless, this is probably my preferred initial solution.