Skip to content

Commit

Permalink
Fix subtle memory leak in nbr_intersection primitive (#3858)
Browse files Browse the repository at this point in the history
Closes rapidsai/graph_dl#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: #3858
  • Loading branch information
ChuckHastings authored Sep 13, 2023
1 parent 17b3447 commit e55c131
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpp/src/prims/detail/nbr_intersection.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -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<edge_property_value_t, thrust::nullopt_t>) {
Expand Down

0 comments on commit e55c131

Please sign in to comment.