Use vespalib::alloc::Allo instead. Will handle large documents smoother.
@@ -204,10 +204,10 @@ seek_past(LidInfoWithLidV::const_iterator begin, LidInfoWithLidV::const_iterator
}
struct LidAndBuffer {
- LidAndBuffer(uint32_t lid, uint32_t sz, std::unique_ptr<char[]> buf) : _lid(lid), _size(sz), _buf(std::move(buf)) {}
+ LidAndBuffer(uint32_t lid, uint32_t sz, vespalib::alloc::Alloc buf) : _lid(lid), _size(sz), _buf(std::move(buf)) {}
uint32_t _lid;
uint32_t _size;
- std::unique_ptr<char[]> _buf;
+ vespalib::alloc::Alloc _buf;
};
}
@@ -233,7 +233,7 @@ WriteableFileChunk::read(LidInfoWithLidV::const_iterator begin, size_t count, IB
assert(chunk == _active->getId());
buffer = _active->getLid(li.getLid());
}
- auto copy = std::make_unique<char[]>(buffer.size());
+ auto copy = vespalib::alloc::Alloc::alloc(buffer.size());
memcpy(copy.get(), buffer.data(), buffer.size());
buffers.emplace_back(li.getLid(), buffer.size(), std::move(copy));
} else {
@@ -243,7 +243,7 @@ WriteableFileChunk::read(LidInfoWithLidV::const_iterator begin, size_t count, IB
}
for (auto & entry : buffers) {
visitor.visit(entry._lid, vespalib::ConstBufferRef(entry._buf.get(), entry._size));
- entry._buf.reset();
+ entry._buf = vespalib::alloc::Alloc();
}
for (auto & it : chunksOnFile) {
auto first = find_first(begin, it.first);
