I would like to know how to "clean" memory on Mac OS X. If you hav the developer tools installed, you can use the purge
command to clean the memory. However, if the dev tools are not installed, this command will not work. Other applications are able to do this so I know it's possible.
How might one program an app that would "clean" the memory, meaning remove inactive memory and make more space available in free memory?
Memory Clean overview Memory Clean is app for optimizing your Mac's memory. The app replicates the feeling of a fresh system restart and helps to keep your Mac running smoothly. The app works by purging your Mac's inactive memory and is best used when you close a memory hogging app that you won't be using again soon.
Memory Clean is an app for cleaning up your Mac OS X device memory at intervals. Memory Clean is available from the App Store or several download sites, and installs easily. Memory Clean is a free app.
Press and hold the Option (⌥) key, or click and hold any app until the apps jiggle. Click Delete button next to the app that you want to delete, then click Delete to confirm. The app is deleted immediately. Apps that don't show either didn't come from the App Store or are required by your Mac.
One workaround is to malloc as much memory as you can, then free that memory. See the code below taken from another example:
ints = size / sizeof(unsigned int);
unsigned int* mem;
mem = (unsigned int*) malloc(size);
for (i=0; i<ints; i++) {
mem[i] = rand();
}
free(mem);
Of course it's up to you to decide what you mean by clearing memory, and how much to malloc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With