[Lldb-commits] [lldb] [lldb] Fix and speedup the `memory find` command (PR #104193)
Dmitry Vasilyev via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 28 10:29:02 PDT 2024
slydiman wrote:
LGTM,
but it is necessary to debug the test and make it more stable (it is still red).
I assumed that something is wrong with the first resize() because of capacity=0.
> I'm using the SmallVector for the resize_for_overwrite functionality (allocating memory without initializing it).
SmallVector.h:
```
/// Like resize, but \ref T is POD, the new values won't be initialized.
void resize_for_overwrite(size_type N) { resizeImpl<true>(N); }
template <bool ForOverwrite> void resizeImpl(size_type N) {
if (N == this->size())
return;
if (N < this->size()) {
this->truncate(N);
return;
}
this->reserve(N);
for (auto I = this->end(), E = this->begin() + N; I != E; ++I)
if (ForOverwrite)
new (&*I) T; // <<< We don't need it at all, especially for a large size
else
new (&*I) T();
this->set_size(N);
}
```
Probably it is better to just allocate the own buffer once at the beginning and do not resize anything.
https://github.com/llvm/llvm-project/pull/104193
More information about the lldb-commits
mailing list