Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtiomTr committed Jun 5, 2024
1 parent e1128ec commit 1c65661
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 3 additions & 1 deletion arkworks3-sppark-wlc/cuda/pippenger_inf.cu
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,9 @@ RustError mult_pippenger_faster_inf(RustContext<bucket_t, affine_t, scalar_t> *c
// Allocate device storage, transfer bases
extern "C"
void mult_pippenger_faster_free(RustContext<bucket_t, affine_t, scalar_t> *context) {
free(context->context);
cudaFreeHost(context->context->h_scalars);
cudaFreeHost(context->context->h_scalar_map);
delete context->context;
}

#endif // __CUDA_ARCH__
4 changes: 0 additions & 4 deletions arkworks3-sppark-wlc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ extern "C" {
}

pub fn multi_scalar_mult_init<G: AffineCurve>(points: &[G]) -> MultiScalarMultContext {
println!("INIT!");

let mut ret = MultiScalarMultContext {
context: std::ptr::null_mut(),
};
Expand All @@ -67,8 +65,6 @@ pub fn multi_scalar_mult_init<G: AffineCurve>(points: &[G]) -> MultiScalarMultCo
}

pub fn multi_scalar_mult_free(context: &mut MultiScalarMultContext) {
println!("FREE!");

unsafe {
mult_pippenger_faster_free(context);
}
Expand Down

0 comments on commit 1c65661

Please sign in to comment.