From e55c131e35081e368db9b315a5f9706e048709f8 Mon Sep 17 00:00:00 2001 From: Chuck Hastings <45364586+ChuckHastings@users.noreply.github.com> Date: Wed, 13 Sep 2023 13:01:24 -0400 Subject: [PATCH] Fix subtle memory leak in nbr_intersection primitive (#3858) Closes https://github.com/rapidsai/graph_dl/issues/259 A customer found a subtle memory leak in Jaccard similarity. Tracked it down to this subtle error. `major_nbr_indices` is an `std::optional` that is initialized to `std::nullopt`. Overwriting the dereferenced entry replaces the value but does not mark the optional as containing a value. So the resulting value is never destroyed. Authors: - Chuck Hastings (https://github.com/ChuckHastings) Approvers: - Seunghwa Kang (https://github.com/seunghwak) URL: https://github.com/rapidsai/cugraph/pull/3858 --- cpp/src/prims/detail/nbr_intersection.cuh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/prims/detail/nbr_intersection.cuh b/cpp/src/prims/detail/nbr_intersection.cuh index f4c4745b14c..2f30faebb3e 100644 --- a/cpp/src/prims/detail/nbr_intersection.cuh +++ b/cpp/src/prims/detail/nbr_intersection.cuh @@ -1023,7 +1023,7 @@ nbr_intersection(raft::handle_t const& handle, (*major_nbr_offsets).begin() + 1); } - std::tie(*major_nbr_indices, std::ignore) = shuffle_values( + std::tie(major_nbr_indices, std::ignore) = shuffle_values( major_comm, local_nbrs_for_rx_majors.begin(), local_nbr_counts, handle.get_stream()); if constexpr (!std::is_same_v) {