SliTaz SliTaz Forum

You are not logged in.

#1 2014-07-16 12:00:22

allen
Member
Registered: 2014-06-22
Posts: 36

SliTaz 4.0-base: Clearing memory cache

Tidbit of information I picked up off a Linux forum after finding unzip had pretty much gobbled all memory after decompressing a large archive.

I ran this command to clear the memory cache (via a simple shell: clearmem).

[c]sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"[/c]

Before and after printout...

[c]root@rmp5710:/# free[/c]

[c]total         used         free       shared      buffers[/c]

[c]Mem:        229520       225652         3868            0         1740[/c]

[c]-/+ buffers:             223912         5608[/c]

[c]Swap:            0            0            0[/c]

[c]root@rmp5710:/# clearmem[/c]

[c]root@rmp5710:/# free[/c]

[c]total         used         free       shared      buffers[/c]

[c]Mem:        229520        15988       213532            0          476[/c]

[c]-/+ buffers:              15512       214008[/c]

[c]Swap:            0            0            0[/c]

Full story can be found here. You might want to read the comments as most were positive though there were some on the negative side. Works well for me with no ill side affects. I now run it as a nightly cron job and at the end of cgi scripts.. those that run unzip or other memory hogs.

[c]http://www.unixmen.com/how-to-clear-memory-cache-on-linux-servers/[/c]

Offline

#2 2014-07-18 08:09:52

devl547
Administrator
Registered: 2011-06-01
Posts: 285

Re: SliTaz 4.0-base: Clearing memory cache

>unzip had pretty much gobbled all memory after decompressing a large archive.

http://www.linuxatemyram.com/

And dont mess with disk caching subsystem.

Offline

#3 2014-07-18 11:01:51

allen
Member
Registered: 2014-06-22
Posts: 36

Re: SliTaz 4.0-base: Clearing memory cache

Thank you.. I appreciate information on the topic. I have been reading further and find clearing the disk cache questionable as I originally read and posted. The information found on the link you posted mentions it speeds up the system rather than slowing it down. Real time evaluations I have found no difference before or after clearing the disk cache. I will further research the topic and appreciate you and any others bring me up to speed as I am a newbie who likes to gobble up information and learn. I sincerely appreciate you, mojo, and others taking the time to help/bring me up to speed.. though at 60 my processing is much slowwer. smile

Allen

Offline

#4 2014-07-19 18:12:53

devl547
Administrator
Registered: 2011-06-01
Posts: 285

Re: SliTaz 4.0-base: Clearing memory cache

Allen, by manually clearing cache, you also clear caches of all running programs and force them to re-read stuff from your hdd and recache it.

The system will clear caches by itself if needed, no there is actually no need for doing manual cache drop (maybe for debug or testing, but not for everyday pc usage)

Offline

#5 2014-07-25 02:23:24

allen
Member
Registered: 2014-06-22
Posts: 36

Re: SliTaz 4.0-base: Clearing memory cache

Again thank you dev for the additional information. I truly hope others are reading this thread including doing their own research on the subject as I find it important knowledge.

I find this interesting. I abandoned my original bash script which used unzip to decompress archives. I switched to php. Php's class ZipArchive seems much better at memory management as it uses half the memory unzip used to decompress the same archive. Any idea why?

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.026 seconds, 7 queries executed - Memory usage: 1.54 MiB (Peak: 1.77 MiB) ]