Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Freeing up System Memory (RAM) by Emptying the Trash

Okay Got a weird one here.



I am not talking about Trash taking up Storage Memory (Hard Disc Drive (HDD) Space), but System Memory (RAM).


So I was doing some downloading of content for DAZ Studio and the Zip files would auto decompressed, then tossed the Zip file into the trash, leaving the content installer behind. Just the way it should.

After about a hundred files, I notiec the system become slower, so I open activity Monitor and find that of my 8GB, I have less then a 100KB free.

This is wierd, because the only app open is Safari.

I know Safari keep a cache of recent pages, but GB's of them?

Then I decided to empty the trash and Presto I suddenly have 5GB Free, this is with Safari remaining open.

I though, well maybe the Time To Live on the cached items ran out.

That was until I notied it happen again, and again when I emptied the Trash it freed up System Memory (RAM).

I have seen this happen about ten times now, filling up the Trash takes up System Memory (RAM).


This system is a 2010 MacMini, with 8GB and MacOS 10.6.8.

I tested this in MacOS 10.5 on a iBook and the same thing happened.


SO here is the Question:


Has anyone else seen this?

Can anyone double check this?

Is this a Memory Leak in the Trash system?

OR

Is this the Way the trash system is meant to work.

Mac mini, Mac OS X (10.6.8), 8GB RAM

Posted on Jan 2, 2012 6:09 AM

Reply
5 replies

Jan 2, 2012 9:22 AM in response to Haslor

My guess is that you had accessed those files, so the file system was caching the file contents until it found something better to use the memory for. However, when you empty the trash the files really go away, and thus the file system can no longer cache the contents of the file.


When looking at free RAM you need to combine BOTH the Free and the Inactive to get a more realistic estimate of RAM available for re-use.

Jan 2, 2012 9:39 AM in response to BobHarris

Bob,


While that makes sense, why would the Unzip Utility/OS need to cache a file.

I can understand caching a web page, I might come back to it.

I can understand Caching a document file I am working on, in memory for faster access.

But if I have unzipped something and placed it in the trash, why hang on to that.

Shouldn't the act of placing it in the trash, remove it from cashe?

And if Inactive Memory is also Free Memory, then why does my system slow down?

Also we are talking over hours here not minutes, isn't there a TTL on the cached files?


Here a few Images for you to ponder:

This is before I stated my little test of Decompressing 85 files.

User uploaded file

This is after the decompression:

User uploaded file

and after placing them in the trash:

User uploaded file

And after emptying the trash:

User uploaded file

So while this seems to support your theory, my questions is why does my machine slow down if Inactive memory is "Free Memory"?

Jan 2, 2012 10:02 AM in response to Haslor

why would the Unzip Utility/OS need to cache a file.

I can understand caching a web page,


It doesn't. The Unzip utility reads the file, and writes new files. All of this goes through the file system. It is the file system that is caching recently read or written data. When you delete a file that is cached by the file system, the file system has nothing to cache. The cache is a least recently used cache, so as you access new files (read or write) the file system will discard old cached data and cache the new stuff. If the operating system needs more RAM for other things, the file system will give up data it has cached, starting with the oldest stuff it has cached. If the OS does not need the RAM, the file system will attempt to cache as much as it can, as that avoids very expensive (in both time and Power) disk accesses. Accessing the disk is slow. Access the disk consume more power then letting it sit there idle (laptops appreciate not having the disk consume power when it does not need to).

Shouldn't the act of placing it in the trash, remove it from cashe?


The file system does not know that. The Trash is just another directory to the file system. Until the file is actually deleted, it is a real file to the file system. The Trash is a higher level concept used by the Finder. The Finder just creates a directory and puts stuff in it. The file system has no clue that this is something special.


isn't there a TTL on the cached files?


No. There is not Time To Live on the files. They remain cached until they are pushed out of the cache by other needs.


my questions is why does my machine slow down if Inactive memory is "Free Memory"?

My best guess. If some of the cached file data has NOT been flushed to disk (makes writing a file much faster if it is not forced to disk right away). However, in that case, when the RAM is needed for something else, then before the file system can release the cache it must send the unwritten new data to the disk first. And as stated above, disk access is slow. Again this is just a guess.

Freeing up System Memory (RAM) by Emptying the Trash

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.