How to flush the RAM ?

Booting, installing, newbie
Post Reply
Message
Author
User avatar
Bernhardiner
Posts: 43
Joined: Tue 03 Jul 2018, 10:12
Contact:

How to flush the RAM ?

#1 Post by Bernhardiner »

Hi,

does a script exist or which command can be used to flush the RAM in any Puppy?

Regards,
Bernhardiner

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#2 Post by ttuuxxx »

Here try this, just extract it and run it in a terminal
Attachments
ram.tar.gz
(262 Bytes) Downloaded 121 times
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#3 Post by bigpup »

The question is.
Why do you want to do this?
What is the problem?
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
Bernhardiner
Posts: 43
Joined: Tue 03 Jul 2018, 10:12
Contact:

#4 Post by Bernhardiner »

Thank you, ttuuxxx.
It seems to work.

It can be the RAM is not big enough, or it is better not to save everything in the save file.

Regards,
Bernhardiner

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#5 Post by ttuuxxx »

Bernhardiner wrote:Thank you, ttuuxxx.
It seems to work.

It can be the RAM is not big enough, or it is better not to save everything in the save file.

Regards,
Bernhardiner
Your welcome also delete /root/.cache on a regular basis :)
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#6 Post by bigpup »

The save process, for updating the save, is only going to put stuff in the save that needs to be in the save.
It does not put everything that is in memory in the save.
This is not something to worry about.

If you do not want anything new going into the save automatically.
Setup the options in Puppy Event Manager>Save Session.

To make a hard drive install be able to use these options.
In the menu entry that boots it.
Change the pmedia= to pmedia=usbflash.
That will make it run in pupmode 13 and not pupmode 12.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
Bernhardiner
Posts: 43
Joined: Tue 03 Jul 2018, 10:12
Contact:

#7 Post by Bernhardiner »

Hi,

Thanks again, ttuuxxx.

Somewhere in this forum it is written that everything in RAM is saved in the save file.
That is independent from saving manually or automatically.
Thanks for the info about pmedia=usbflash, bigpup.

Regards,
Bernhardiner

backi
Posts: 1922
Joined: Sun 27 Feb 2011, 22:00
Location: GERMANY

#8 Post by backi »

Hi Tttuuxxx !
Your script does work .......but.....it also un-mounts the swapdrive without re-enabling it again......this is a bit annoying.

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#9 Post by bigpup »

Somewhere in this forum it is written that everything in RAM is saved in the save file.
No.
That is someone making too general a statement.

Not everything in ram goes into the save.
Only any changed settings.
Only anything added to Puppy that is not already in the save.
Only stuff already in the save that has changed and only those changes.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#10 Post by vovchik »

Dear all,

This works for me:

Code: Select all

#!/bin/bash
## Bash Script to clear cached memory on (Ubuntu/Debian) Linux
## By Philipp Klaus
## see <http://blog.philippklaus.de/2011/02/clear-cached-memory-on-ubuntu/>

if [ "$(whoami)" != "root" ]
then
  echo "You have to run this script as Superuser!"
  exit 1
fi

# Get Memory Information
freemem_before=$(cat /proc/meminfo | grep MemFree | tr -s ' ' | cut -d ' ' -f2) && freemem_before=$(echo "$freemem_before/1024.0" | bc)
cachedmem_before=$(cat /proc/meminfo | grep "^Cached" | tr -s ' ' | cut -d ' ' -f2) && cachedmem_before=$(echo "$cachedmem_before/1024.0" | bc)

# Output Information
echo -e "This script will clear cached memory and free up your ram.\n\nAt the moment you have $cachedmem_before MiB cached and $freemem_before MiB free memory."

# Test sync
if [ "$?" != "0" ]
then
  echo "Something went wrong, It's impossible to sync the filesystem."
  exit 1
fi

# Clear Filesystem Buffer using "sync" and Clear Caches
sync && echo 3 > /proc/sys/vm/drop_caches

freemem_after=$(cat /proc/meminfo | grep MemFree | tr -s ' ' | cut -d ' ' -f2) && freemem_after=$(echo "$freemem_after/1024.0" | bc)

# Output Summary
echo -e "This freed $(echo "$freemem_after - $freemem_before" | bc) MiB, so now you have $freemem_after MiB of free RAM."

exit 0
With kind regards,
vovchik

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#11 Post by B.K. Johnson »

bigpup
I use that pmedia=usbflash with syslinux.cfg, but where does one make the related change in a Grub4Dos configured system?
TIA
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#12 Post by rockedge »

@vovchik

nice little script..thanks for the tip.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#13 Post by musher0 »

Hello, all.

About 4 years ago, the French side (forum members jplt, Médor, myself,
with suggestions from ASRI and augras, etc.) produced this.

Parms you can pass as $1 are as follows:
# "chrono" : save as a history file; no window pops up;

# "simple" : for operation from the terminal;

# "histo" : combines the two above.
If you wish to consult the history, for monitoring purposes.
-=> useful if you think something is wrong with your RAM; <=-
You run it every now and then during your session. Readings are saved
in file /root/my-documents/tmp/suivimev.his

# "flafla", "bling" or nothing: show results with transparency (default).

E.g. < ./cleanup_memory bling > will show the results as in the scrot.
The title bar shows how much RAM was recoup'ed, and if swap is in use.

Whatever little text there is is shown in the language of the system. At
this time EN or FR only; translators for other languages welcome.

Requires the real less, not the busybox one. If

Code: Select all

ls -Algor /usr/bin/less
does not show a symbolic link, you have the real less.

Enjoy. BFN.
Attachments
cleanup_memory.zip
This latest v. corrects a bug in the less display, in histo and simple modes.
Unzip in a &quot;bin&quot; directory in your $PATH and make executable. Contains a
&quot;cleanup_memory&quot; symlink to script cleanup_memory4b1.
(2.81 KiB) Downloaded 89 times
history-mode.jpg
(143.24 KiB) Downloaded 186 times
cleanup-RAM-4b-EN.jpg
Default display.
(113.63 KiB) Downloaded 199 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#14 Post by Flash »

I think the browser is the usual culprit that fills the RAM with junk. I find that restarting the graphical server, which kills Firefox, then restarting Firefox and telling it to restore the tabs it had open before it was killed, seems to clear out a lot of junk while leaving the browser the way it was before restarting the graphical server.

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

#15 Post by dancytron »

B.K. Johnson wrote:bigpup
I use that pmedia=usbflash with syslinux.cfg, but where does one make the related change in a Grub4Dos configured system?
TIA
Just add it on the line that starts with "kernel", like so:
title Puppy Linux precise572a in sda3 dir precise572a
rootnoverify (hd0,1)
kernel /precise572a/vmlinuz pmedia=usbflash psubdir=precise572a
initrd /precise572a/initrd.gz

B.K. Johnson
Posts: 807
Joined: Mon 12 Oct 2009, 17:11

#16 Post by B.K. Johnson »

dancytron
Thanks for responding.
[color=blue]B.K. Johnson
tahrpup-6.0.5 PAE (upgraded from 6.0 =>6.0.2=>6.0.3=>6.0.5 via quickpet/PPM=Not installed); slacko-5.7 occasionally. Frugal install, pupsave file, multi OS flashdrive, FAT32 , SYSLINUX boot, CPU-Dual E2140, 4GB RAM[/color]

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#17 Post by bigpup »

Just to add to above information.
All Grub4dos menu entries should already have a pmedia= in their kernel line entries.
Just change the pmedia= that is already there to pmedia=usbflash
There needs to be only one pmedia= entry.

Understand that when you do this. Puppy will run in pupmode 13. It will use a saveramdisk that is going to use some ram all the time.
Everything that normally goes into the save, will stay in this saveramdisk, until you choose to have it go into the real save file/folder, by having a set time to flush to the save file/folder, clicking on the save icon on the desktop, or do a shutdown.
Setting options are in Puppy Event Manager>Save Session.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

Post Reply