diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-25 18:59:29 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-26 20:54:35 +0100 |
commit | 20bedf320ef3e4e4e6d872aa66fd2e17c68428de (patch) | |
tree | 94a6611436ce1bfade46d2cf5faef8dd935d4fd0 /src/rpc | |
parent | Merge pull request #2339 (diff) | |
download | monero-20bedf320ef3e4e4e6d872aa66fd2e17c68428de.tar.xz |
rpc: decrease memory usage a bit in getblocks.bin
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index a5de36118..1d3d31c74 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -205,14 +205,17 @@ namespace cryptonote } size_t txidx = 0; ntxes += bd.second.size(); - for(const auto& t: bd.second) + for (std::list<cryptonote::blobdata>::iterator i = bd.second.begin(); i != bd.second.end(); ++i) { + unpruned_size += i->size(); if (req.prune) - res.blocks.back().txs.push_back(get_pruned_tx_blob(t)); + res.blocks.back().txs.push_back(get_pruned_tx_blob(std::move(*i))); else - res.blocks.back().txs.push_back(t); + res.blocks.back().txs.push_back(std::move(*i)); + i->clear(); + i->shrink_to_fit(); pruned_size += res.blocks.back().txs.back().size(); - unpruned_size += t.size(); + res.output_indices.back().indices.push_back(COMMAND_RPC_GET_BLOCKS_FAST::tx_output_indices()); bool r = m_core.get_tx_outputs_gindexs(b.tx_hashes[txidx++], res.output_indices.back().indices.back().indices); if (!r) |