Pre-size the vector in the pthread_create ENOMEM test.
Just to avoid the possibility of an unfortunate mmap occurring in order to grow the vector. Bug: N/A Test: ran tests Change-Id: I850740461d761916a0377272664159d010da7b84
This commit is contained in:
parent
c6021960a4
commit
575129886c
|
@ -2117,8 +2117,9 @@ TEST(pthread, pthread_create__mmap_failures) {
|
||||||
|
|
||||||
const auto kPageSize = sysconf(_SC_PAGE_SIZE);
|
const auto kPageSize = sysconf(_SC_PAGE_SIZE);
|
||||||
|
|
||||||
// Use up all the VMAs. By default this is 64Ki.
|
// Use up all the VMAs. By default this is 64Ki (though some will already be in use).
|
||||||
std::vector<void*> pages;
|
std::vector<void*> pages;
|
||||||
|
pages.reserve(64 * 1024);
|
||||||
int prot = PROT_NONE;
|
int prot = PROT_NONE;
|
||||||
while (true) {
|
while (true) {
|
||||||
void* page = mmap(nullptr, kPageSize, prot, MAP_ANON|MAP_PRIVATE, -1, 0);
|
void* page = mmap(nullptr, kPageSize, prot, MAP_ANON|MAP_PRIVATE, -1, 0);
|
||||||
|
|
Loading…
Reference in New Issue