Re: a way to clear inactive RAM
Re: a way to clear inactive RAM
- Subject: Re: a way to clear inactive RAM
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 06 Nov 2012 15:23:07 +0100
Le 6 nov. 2012 à 12:13, Tom Davie <email@hidden> a écrit :
>
> On 6 Nov 2012, at 11:01, Nick Rogers <email@hidden> wrote:
>
>> Hi,
>>
>> Thanks for the replies.
>> I was trying to achieve what essentially "free memory" apps on the Mac AppStore do.
>> The RAM usage can be divided into four parts as shown in Activity Monitor.
>> 1. Free
>> 2. In-active
>> 3. Active
>> 4. Wired
>>
>> When I used my earlier app to allocate memory equal to free + inactive bytes, for the execution of the program it used to make the system less responsive for a few seconds and on release and quitting the app, most of the inactive memory would shift under free.
>>
>> e.g. if free is 1GB and inactive is 1.5GB, then after run, free would be 2.45GB and inactive just 50MB.
>
> Why on earth would you want to release inactive memory? This is memory that is in use by applications, just ones that haven't been scheduled in for a while. This RAM IIRC is automatically paged out to disk, so that if it is needed it can simply be overwritten, just like free memory, but has the side benefit that if it's not overwritten, then the inactive applications can be brought back to life very fast.
The memory is paged out to disk only if it is read-write memory that was modified, and is not already on the disk. All mapped frameworks, the full content of the "Unified Buffer Cache" (which generally represent most of the inactive memory) and other stuff are keep in RAM to provide faster access, but are already present on disk and will be simply discarded if the system need more RAM.
So not only freeing inactive memory is useless, but it is also guarantee to make your system slower.
>
> Freeing it all would not gain anything, but would cause inactive apps to take much longer to return to the foreground.
>
> As an aside - "free" memory is a bad thing – having free memory means your system is not using all the RAM it has available to make things nice and fast. I fully expect my machine to use "free" memory for things like disk caches if I currently do not need the RAM for applications.
>
> Tom Davie
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
-- Jean-Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden