hnswlib 0.5.3 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ namespace hnswlib {
29
29
  }
30
30
 
31
31
  ~BruteforceSearch() {
32
- free(data_);
32
+ if (data_) free(data_);
33
33
  }
34
34
 
35
35
  char *data_;
@@ -129,6 +129,10 @@ namespace hnswlib {
129
129
 
130
130
 
131
131
  std::ifstream input(location, std::ios::binary);
132
+
133
+ if (!input.is_open())
134
+ throw std::runtime_error("Cannot open file");
135
+
132
136
  std::streampos position;
133
137
 
134
138
  readBinaryPOD(input, maxelements_);
@@ -76,14 +76,15 @@ namespace hnswlib {
76
76
  };
77
77
 
78
78
  ~HierarchicalNSW() {
79
-
80
- free(data_level0_memory_);
81
- for (tableint i = 0; i < cur_element_count; i++) {
82
- if (element_levels_[i] > 0)
83
- free(linkLists_[i]);
79
+ if (data_level0_memory_) free(data_level0_memory_);
80
+ if (linkLists_) {
81
+ for (tableint i = 0; i < cur_element_count; i++) {
82
+ if (element_levels_[i] > 0)
83
+ if (linkLists_[i]) free(linkLists_[i]);
84
+ }
85
+ free(linkLists_);
84
86
  }
85
- free(linkLists_);
86
- delete visited_list_pool_;
87
+ if (visited_list_pool_) delete visited_list_pool_;
87
88
  }
88
89
 
89
90
  size_t max_elements_;
@@ -3,7 +3,7 @@
3
3
  # Hnswlib.rb provides Ruby bindings for the Hnswlib.
4
4
  module Hnswlib
5
5
  # The version of Hnswlib.rb you install.
6
- VERSION = '0.5.3'
6
+ VERSION = '0.6.2'
7
7
 
8
8
  # The version of Hnswlib included with gem.
9
9
  HSWLIB_VERSION = '0.6.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hnswlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-05 00:00:00.000000000 Z
11
+ date: 2022-06-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Hnswlib.rb provides Ruby bindings for the Hnswlib.
14
14
  email:
@@ -41,6 +41,7 @@ metadata:
41
41
  homepage_uri: https://github.com/yoshoku/hnswlib.rb
42
42
  source_code_uri: https://github.com/yoshoku/hnswlib.rb
43
43
  changelog_uri: https://github.com/yoshoku/hnswlib.rb/blob/main/CHANGELOG.md
44
+ rubygems_mfa_required: 'true'
44
45
  post_install_message:
45
46
  rdoc_options: []
46
47
  require_paths:
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
57
  - !ruby/object:Gem::Version
57
58
  version: '0'
58
59
  requirements: []
59
- rubygems_version: 3.3.7
60
+ rubygems_version: 3.2.33
60
61
  signing_key:
61
62
  specification_version: 4
62
63
  summary: Ruby bindings for the Hnswlib.