mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
memory manage statistics
Summary: Earlier Statistics object was a raw pointer. This meant the user had to clear up the Statistics object after creating the database. In most use cases the database is created in a function and the statistics pointer is out of scope. Hence the statistics object would never be deleted. Now Using a shared_ptr to manage this. Want this in before the next release. Test Plan: make all check. Reviewers: dhruba, emayanke Reviewed By: emayanke CC: leveldb Differential Revision: https://reviews.facebook.net/D9735
This commit is contained in:
@@ -16,11 +16,9 @@ struct TableAndFile {
|
||||
unique_ptr<Table> table;
|
||||
};
|
||||
|
||||
static class Statistics* dbstatistics;
|
||||
|
||||
static void DeleteEntry(const Slice& key, void* value) {
|
||||
TableAndFile* tf = reinterpret_cast<TableAndFile*>(value);
|
||||
RecordTick(dbstatistics, NO_FILE_CLOSES);
|
||||
delete tf;
|
||||
}
|
||||
|
||||
@@ -38,9 +36,7 @@ TableCache::TableCache(const std::string& dbname,
|
||||
dbname_(dbname),
|
||||
options_(options),
|
||||
storage_options_(storage_options),
|
||||
cache_(NewLRUCache(entries, options->table_cache_numshardbits)) {
|
||||
dbstatistics = options->statistics;
|
||||
}
|
||||
cache_(NewLRUCache(entries, options->table_cache_numshardbits)) {}
|
||||
|
||||
TableCache::~TableCache() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user