mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-01 02:02:28 +00:00
Use better memory strategy on Windows
Rather than using the the rollo global to pick addresses, we select them randomly now using a conservative vaspace.
This commit is contained in:
parent
6a5d4ed65b
commit
2018cac11f
13 changed files with 113 additions and 124 deletions
|
@ -41,7 +41,7 @@
|
|||
|
||||
void map_unmap_one_page(void) {
|
||||
void *p;
|
||||
if ((p = mmap(randaddr(), 1, PROT_READ | PROT_WRITE,
|
||||
if ((p = mmap(__maps_randaddr(), 1, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)) == MAP_FAILED)
|
||||
__builtin_trap();
|
||||
if (munmap(p, 1))
|
||||
|
@ -61,8 +61,8 @@ int main() {
|
|||
int n = 10000;
|
||||
kprintf("%20s creating %d sparse maps...\n", "", n);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (mmap(randaddr(), 1, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
|
||||
-1, 0) == MAP_FAILED)
|
||||
if (mmap(__maps_randaddr(), 1, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) == MAP_FAILED)
|
||||
__builtin_trap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue