@@ -167,7 +167,7 @@ static void *ReturnNullptrOnOOMOrDie(uptr size, const char *mem_type,
167
167
168
168
// Assumption: VirtualAlloc is the last system call that was invoked before
169
169
// this method.
170
- // VirtualAlloc emits one of 2 error codes when running out of memory
170
+ // VirtualAlloc emits one of 3 error codes when running out of memory
171
171
// 1. ERROR_NOT_ENOUGH_MEMORY:
172
172
// There's not enough memory to execute the command
173
173
// 2. ERROR_INVALID_PARAMETER:
@@ -176,12 +176,12 @@ static void *ReturnNullptrOnOOMOrDie(uptr size, const char *mem_type,
176
176
// (the `lpMaximumApplicationAddress` field within the `SystemInfo` struct).
177
177
// This does not seem to be officially documented, but is corroborated here:
178
178
// https://stackoverflow.com/questions/45833674/why-does-virtualalloc-fail-for-lpaddress-greater-than-0x6ffffffffff
179
-
180
- // Note - It's possible that 'ERROR_COMMITMENT_LIMIT' needs to be handled here
181
- // as well. It is currently not handled due to the lack of a reproducer that
182
- // induces the error code.
179
+ // 3. ERROR_COMMITMENT_LIMIT:
180
+ // VirtualAlloc will return this if e.g. the pagefile is too small to commit
181
+ // the requested amount of memory.
183
182
if (last_error == ERROR_NOT_ENOUGH_MEMORY ||
184
- last_error == ERROR_INVALID_PARAMETER)
183
+ last_error == ERROR_INVALID_PARAMETER ||
184
+ last_error == ERROR_COMMITMENT_LIMIT)
185
185
return nullptr ;
186
186
ReportMmapFailureAndDie (size, mem_type, mmap_type, last_error);
187
187
}
0 commit comments