Re: ubc and removable devices
Re: ubc and removable devices
- Subject: Re: ubc and removable devices
- From: Joel Reymont <email@hidden>
- Date: Tue, 10 Nov 2009 09:40:13 +0000
On Nov 10, 2009, at 7:53 AM, Stefan Haller wrote:
Did you try the "purge" command-line tool?
Yes but it doesn't evict mmap-ed dynamic libraries.
You need to allocate 2x physical memory for it to happen.
I have 4Gb of physical memory so allocating twice that
and then touching every page (below) takes over 4 minutes.
It's much faster to place the app on a removable device and
then eject the device to purge the caches of the app data.
I haven't looked for this behavior in the kernel source code
but it seems to be consistent and logical when I think about it.
Another alternative is rebooting but that takes about a minute
and requires me to restore all the apps I have running.
---
#!/usr/bin/env python
import mmap
SIZE = 8589934592L # 8Gb
map = mmap.mmap(-1, SIZE)
map[::4096] = '\x01' * (SIZE // 4096)
---
#include <sys/mman.h>
#include <fcntl.h>
#include <stdio.h>
static long SIZE = 8589934592L;
int main(int argc, char**argv)
{
char *result = mmap(0, SIZE, PROT_READ|PROT_WRITE, MAP_ANON|
MAP_PRIVATE, -1, 0);
if (result != MAP_FAILED)
{
unsigned long i;
for (i = 0; i < SIZE; i += 4096)
result[i] = 1;
return 0;
}
return 1;
}
---
firefox for android!
http://wagerlabs.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden