Skip to content

Commit

Permalink
Ensure storage class to clear resources: refs jubatus#280
Browse files Browse the repository at this point in the history
  • Loading branch information
suma committed Mar 7, 2013
1 parent 5e6390b commit 883912c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/storage/lsh_index_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ void lsh_index_storage::remove_row(const string& row) {
}

void lsh_index_storage::clear() {
master_table_.clear();
master_table_diff_.clear();
lsh_table_.clear();
lsh_table_diff_.clear();
lsh_master_table_t().swap(master_table_);
lsh_master_table_t().swap(master_table_diff_);
lsh_table_t().swap(lsh_table_);
lsh_table_t().swap(lsh_table_diff_);
key_manager_.clear();
}

Expand Down
2 changes: 1 addition & 1 deletion src/storage/norm_l1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ norm_l1::~norm_l1() {
}

void norm_l1::clear() {
sq_norms_.clear();
pfi::data::unordered_map<std::string, float>().swap(sq_norms_);
}

void norm_l1::notify(const std::string& row, float old_val, float new_val) {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/norm_l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ norm_l2::~norm_l2() {
}

void norm_l2::clear() {
sq_norms_.clear();
pfi::data::unordered_map<std::string, float>().swap(sq_norms_);
}

void norm_l2::notify(const std::string& row, float old_val, float new_val) {
Expand Down

0 comments on commit 883912c

Please sign in to comment.