mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 07:54:58 +00:00
Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe
This commit is contained in:
parent
3a9f00c59b
commit
97e97bccab
105 changed files with 629 additions and 290 deletions
|
@ -95,7 +95,11 @@ int main(int argc, char** argv)
|
|||
if (block_size > file_size)
|
||||
continue;
|
||||
|
||||
auto buffer = ByteBuffer::create_uninitialized(block_size);
|
||||
auto buffer_result = ByteBuffer::create_uninitialized(block_size);
|
||||
if (!buffer_result.has_value()) {
|
||||
warnln("Not enough memory to allocate space for block size = {}", block_size);
|
||||
continue;
|
||||
}
|
||||
Vector<Result> results;
|
||||
|
||||
outln("Running: file_size={} block_size={}", file_size, block_size);
|
||||
|
@ -104,7 +108,7 @@ int main(int argc, char** argv)
|
|||
while (timer.elapsed() < time_per_benchmark * 1000) {
|
||||
out(".");
|
||||
fflush(stdout);
|
||||
auto result = benchmark(filename, file_size, block_size, buffer, allow_cache);
|
||||
auto result = benchmark(filename, file_size, block_size, *buffer_result, allow_cache);
|
||||
if (!result.has_value())
|
||||
return 1;
|
||||
results.append(result.release_value());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue