yangyang233333 / smallkv Goto Github PK
View Code? Open in Web Editor NEWA small Key-Value storage engine written in C++.
License: MIT License
A small Key-Value storage engine written in C++.
License: MIT License
在memory/allocate.cpp文件中,Deallocate方法最后删除内存块的代码是不是有问题?感觉好像是在添加新的内存块,没有删除释放的操作。
具体代码如下:
void FreeListAllocate::Deallocate(void *p, int32_t n) {
if (p == nullptr || n == 0) {
logger->error("p cannot be nullptr, n cannot be zero. p={}, n={}", p, n);
return;
}
// 大于MAX_OBJ_SIZE是malloc分配的,也由free回收
if (n > MAX_OBJ_SIZE) {
free(p);
p = nullptr;
return;
}
// 这四行代码感觉好像有问题
auto slot_index = get_index(n);
auto node = static_cast<BlockNode *>(p);
node->next = memory_slot[slot_index];
memory_slot[slot_index] = node;
}
LevelDB中的Arena主要是用于MemTable的,看README内的内存池设计看起来是用于Block的,貌似和Block/Table Cache本身的功能产生了一些冲突?Minor Compaction时生成SSTable时的Block除了最后一个以外都是4k(默认一般考虑4k对齐)的吧,看图总感觉有不少浪费在了小Block上
报错为error: could not convert ‘log’ from ‘const string_view’ {aka ‘const std::basic_string_view’} to ‘absl::string_view’
在文件src/wal/wal_writer.cpp中的22行使用函数absl::ComputeCrc32c(log)前加入修改类型:
absl::string_view new_log(log.data(), log.size());
再将absl::ComputeCrc32c(log)中的log改为new_log之后才编译构建成功。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.