efficient/SuRF

Got a "double free or corruption" when destroy a deserialized SuRF in BitvectorRank

Opened this issue · 0 comments

iele commented

Test Code:

#include
#include
#include "include/surf.hpp"
using namespace surf;
int main() {
std::vectorstd::string keys = {
"f",
"far",
"fast",
"s",
"top",
"toy",
"trie",
};
// basic surf
SuRF* surf = new SuRF(keys);
surf = SuRF::deSerialize(surf->serialize());
std::cout << "destory surf" << std::endl;
surf->destroy();
return 0;
}

Got a core dumped
image

Maybe the issue happens when destroy BitVectorRank:

void destroy()
{
delete[] bits_;
delete[] rank_lut_;
}