(1) fix Status destructor (#4745)

(2) fix grpc-milvus URL
(3) fix hnsw uninitialized variable

Signed-off-by: shengjun.li <shengjun.li@zilliz.com>
pull/4752/head
shengjun.li 2021-02-26 12:26:02 +08:00 committed by GitHub
parent f5d7d917f7
commit af54fd155b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -573,12 +573,9 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t> {
data_level0_memory_=data_level0_memory_new;
// Reallocate all other layers
char ** linkLists_new = (char **) malloc(sizeof(void *) * new_max_elements);
if (linkLists_new == nullptr)
linkLists_ = (char **) realloc(linkLists_, sizeof(void *) * new_max_elements);
if (linkLists_ == nullptr)
throw std::runtime_error("Not enough memory: resizeIndex failed to allocate other layers");
memcpy(linkLists_new, linkLists_,cur_element_count * sizeof(void *));
free(linkLists_);
linkLists_=linkLists_new;
max_elements_=new_max_elements;
@ -1138,7 +1135,9 @@ class HierarchicalNSW : public AlgorithmInterface<dist_t> {
ret += max_elements_ * size_data_per_element_;
ret += max_elements_ * sizeof(void*);
for (auto i = 0; i < max_elements_; ++ i) {
ret += linkLists_[i] ? size_links_per_element_ * element_levels_[i] : 0;
if (element_levels_[i] > 0) {
ret += size_links_per_element_ * element_levels_[i];
}
}
return ret;
}

View File

@ -34,7 +34,9 @@ Status::Status() : state_(nullptr) {
}
Status::~Status() {
delete state_;
if (state_ != nullptr) {
delete[] state_;
}
}
Status::Status(const Status& s) : state_(nullptr) {

View File

@ -185,7 +185,7 @@ if (DEFINED ENV{MILVUS_GRPC_URL})
set(GRPC_SOURCE_URL "$ENV{MILVUS_GRPC_URL}")
else ()
set(GRPC_SOURCE_URL
"https://github.com/youny626/grpc-milvus/archive/master.zip")
"https://github.com/milvus-io/grpc-milvus/archive/master.zip")
endif ()
if (DEFINED ENV{MILVUS_ZLIB_URL})