Make allocator a class

This commit is contained in:
Vitaliy Filippov
2019-11-27 00:50:57 +03:00
parent b8e53f8c67
commit ff7469ee91
7 changed files with 39 additions and 40 deletions
+2 -3
View File
@@ -24,9 +24,7 @@ blockstore::blockstore(spp::sparse_hash_map<std::string, std::string> & config,
open_meta(config);
open_journal(config);
calc_lengths(config);
data_alloc = allocator_create(block_count);
if (!data_alloc)
throw std::bad_alloc();
data_alloc = new allocator(block_count);
}
catch (std::exception & e)
{
@@ -46,6 +44,7 @@ blockstore::blockstore(spp::sparse_hash_map<std::string, std::string> & config,
blockstore::~blockstore()
{
delete data_alloc;
delete flusher;
free(zero_object);
ringloop->unregister_consumer(ring_consumer);