We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
load_file() 里的 key 和 value 都是采用定义为指针然后 new 一个对象空间给它俩,但是函数最后都没有对这两个 string 指针进行 delete 操作,也是存在内存泄露的。
void SkipList<K, V>::load_file() { _file_reader.open(STORE_FILE); std::cout << "load_file-----------------" << std::endl; std::string line; std::string* key = new std::string(); std::string* value = new std::string(); ... }
The text was updated successfully, but these errors were encountered:
load_file() 里的 key 和 value 都是采用定义为指针然后 new 一个对象空间给它俩,但是函数最后都没有对这两个 string 指针进行 delete 操作,也是存在内存泄露的。 void SkipList<K, V>::load_file() { _file_reader.open(STORE_FILE); std::cout << "load_file-----------------" << std::endl; std::string line; std::string* key = new std::string(); std::string* value = new std::string(); ... }
感谢指正,我抽空看一下哈
Sorry, something went wrong.
建议使用智能指针来进行优化,目前的版本check下来在vs上是有报错的
No branches or pull requests
load_file() 里的 key 和 value 都是采用定义为指针然后 new 一个对象空间给它俩,但是函数最后都没有对这两个 string 指针进行 delete 操作,也是存在内存泄露的。
The text was updated successfully, but these errors were encountered: