diff --git a/include/bitcoin/database/impl/query/objects.ipp b/include/bitcoin/database/impl/query/objects.ipp index 4739964d0..d25d44866 100644 --- a/include/bitcoin/database/impl/query/objects.ipp +++ b/include/bitcoin/database/impl/query/objects.ipp @@ -53,7 +53,7 @@ typename CLASS::inputs_ptr CLASS::get_inputs( if (fks.empty()) return {}; - const auto inputs = to_shared(); + const auto inputs = make_shared(); inputs->reserve(fks.size()); for (const auto& fk: fks) @@ -73,7 +73,7 @@ typename CLASS::outputs_ptr CLASS::get_outputs( if (fks.empty()) return {}; - const auto outputs = to_shared(); + const auto outputs = make_shared(); outputs->reserve(fks.size()); for (const auto& fk: fks) @@ -93,7 +93,7 @@ typename CLASS::transactions_ptr CLASS::get_transactions( if (txs.empty()) return {}; - const auto transactions = to_shared(); + const auto transactions = make_shared(); transactions->reserve(txs.size()); for (const auto& tx_fk: txs) @@ -165,8 +165,8 @@ typename CLASS::transaction::cptr CLASS::get_transaction(const tx_link& link, if (!store_.outs.get(tx.outs_fk, outs)) return {}; - const auto inputs = to_shared(); - const auto outputs = to_shared(); + const auto inputs = make_shared(); + const auto outputs = make_shared(); inputs->reserve(tx.ins_count); outputs->reserve(tx.outs_count); @@ -209,11 +209,11 @@ typename CLASS::point::cptr CLASS::make_point(hash_digest&& hash, uint32_t index) NOEXCEPT { // Share null point instances to reduce memory consumption. - static const auto null_point = system::to_shared(); + static const auto null_point = system::make_shared(); if (index == point::null_index) return null_point; - return system::to_shared(std::move(hash), index); + return system::make_shared(std::move(hash), index); } TEMPLATE @@ -259,7 +259,7 @@ typename CLASS::inputs_ptr CLASS::get_spenders( { using namespace system; const auto point_fks = to_spenders(link); - const auto inputs = to_shared(); + const auto inputs = make_shared(); inputs->reserve(point_fks.size()); // TODO: eliminate shared memory pointer reallocation. diff --git a/src/memory/mman-win32/mman.cpp b/src/memory/mman-win32/mman.cpp index 1117c6db7..bc9e7d852 100644 --- a/src/memory/mman-win32/mman.cpp +++ b/src/memory/mman-win32/mman.cpp @@ -259,12 +259,14 @@ int ftruncate(int fd, oft__ size) noexcept // sets errno return -1; } - + // "UnmapViewOfFile must be called first to unmap all views and call - // CloseHandle to close file mapping object before can call SetEndOfFile." - - // we have earlier called CloseHandle to close file mapping object (in mmap) + // CloseHandle to close file mapping object before can call SetEndOfFile." + // We have earlier called CloseHandle to close file mapping object (in mmap) // but have not called UnmapViewOfFile before calling this from remap_() and // it is apparently working. + + // This sets the physical size of the file, making this an fallocate. if (SetEndOfFile(handle) == FALSE) { errno = last_error(EIO);