Commit bec2b4d2 authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

[Memory] Experiment to try using regular version of 'new T[]'.

- Use normal new, vs. nothrow new.
- Modify NewArray to have only 1 invocation of new.

Bug: chromium:752056
Change-Id: I1a2fb3626264b1bf647af9227d55e9b54e44e8b6
Reviewed-on: https://chromium-review.googlesource.com/600895Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47173}
parent 575ec863
......@@ -34,13 +34,13 @@ class V8_EXPORT_PRIVATE Malloced {
template <typename T>
T* NewArray(size_t size) {
T* result = new (std::nothrow) T[size];
if (result == nullptr) {
int retries = 0;
while (true) {
T* result = new T[size];
if (result != nullptr) return result;
if (retries++ == 1) FatalProcessOutOfMemory("NewArray");
V8::GetCurrentPlatform()->OnCriticalMemoryPressure();
result = new (std::nothrow) T[size];
if (result == nullptr) FatalProcessOutOfMemory("NewArray");
}
return result;
}
template <typename T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment