Skip to content

Commit

Permalink
fix memory leak in Rank (VowpalWabbit#31)
Browse files Browse the repository at this point in the history
* fix memory leak in Rank

* merge fix into existing loop

* clean up examples first before pushing back to pool
  • Loading branch information
homezcx authored and rajan-chari committed Jan 11, 2019
1 parent 6bbaba2 commit 4299daf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rlclientlib/vw_model/safe_vw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ namespace reinforcement_learning {
scores[i] = predictions[i].score;
}

// push examples back into pool for re-use
for (auto&& ex : examples)
// clean up examples and push examples back into pool for re-use
for (auto&& ex : examples) {
ex->pred.a_s.delete_v();
_example_pool.emplace_back(ex);
}

// cleanup
examples.delete_v();
Expand Down

0 comments on commit 4299daf

Please sign in to comment.