@@ -167,7 +167,7 @@ static void *ReturnNullptrOnOOMOrDie(uptr size, const char *mem_type,
167167
168168 // Assumption: VirtualAlloc is the last system call that was invoked before
169169 // 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
171171 // 1. ERROR_NOT_ENOUGH_MEMORY:
172172 // There's not enough memory to execute the command
173173 // 2. ERROR_INVALID_PARAMETER:
@@ -176,12 +176,12 @@ static void *ReturnNullptrOnOOMOrDie(uptr size, const char *mem_type,
176176 // (the `lpMaximumApplicationAddress` field within the `SystemInfo` struct).
177177 // This does not seem to be officially documented, but is corroborated here:
178178 // 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.
183182 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)
185185 return nullptr ;
186186 ReportMmapFailureAndDie (size, mem_type, mmap_type, last_error);
187187}
0 commit comments