I tried to implement Drop for FutharkContext as suggested in the issue. However, removing the Copy trait (as required) led to compilation errors in the Array_::from_vec methods. I am not certain there is no way around this, but I was not able to figure anything out after some rooting around.
Consumers for whom an RAII-based cleanup makes sense can use free in an appropriate Drop implementation. In the specific case of neptune-triton, we only ever allocate a single FutharkContext per device (per process) — which is another strategy to avoid leaking contexts.
Closes #15 .
I tried to implement
Drop
forFutharkContext
as suggested in the issue. However, removing theCopy
trait (as required) led to compilation errors in theArray_::from_vec
methods. I am not certain there is no way around this, but I was not able to figure anything out after some rooting around.Consumers for whom an RAII-based cleanup makes sense can use
free
in an appropriateDrop
implementation. In the specific case ofneptune-triton
, we only ever allocate a singleFutharkContext
per device (per process) — which is another strategy to avoid leaking contexts.