How much RAM is your Puppy using?

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
Bruce B

How much RAM is your Puppy using?

#1 Post by Bruce B »

How can you know? -> how you can know
(or at least get closer readings)


I think we have software very serious about doing things, which in
Puppy, can lead to artificially high RAM usage reports when using
BusyBox Free.

1) Linux is serious about using RAM and keeping things in cache.

2) BusyBox Free command is serious about never factoring the
caches when it reports used memory.

The text file attached to this post is designed to be converted to a
script, after you read it.

This is what the script does:

* displays free report
* drops cache from RAM
* displays free report

Result

Beside freeing RAM, which you may want to do anyway, it gives
you a report much closer to actual RAM usage, by dropping
the caches, then reading the memory usage. The two reports,
(before and after), display on screen and you can see the
differences.

-----------

The script has been tested throughly on Dingo 4.00 only, by me,
before submission. It requires kernel version 2.6.16 or newer.

Enjoy, and use at your own risk.

--------------

Attachment is deleted. The entire propose of my post, the how-to is clearly not understood. Not being a professional author, it's as good as I can do and it's all I'm willing to do.


Sorry.
Last edited by Bruce B on Sun 07 Sep 2008, 16:38, edited 1 time in total.

Bruce B

#2 Post by Bruce B »

Here is an output sample from freemem

Code: Select all

{~} freemem

Before dropping caches

              total         used         free       shared      buffers
  Mem:       126056       112836        13220            0         2044
 Swap:       102392            0       102392
Total:       228448       112836       115612

After dropping caches

              total         used         free       shared      buffers
  Mem:       126056        78424        47632            0           60
 Swap:       102392            0       102392
Total:       228448        78424       150024

{~} 

linuxcbon
Posts: 1312
Joined: Thu 09 Aug 2007, 22:54

#3 Post by linuxcbon »

I tried it too.
Can you explain what it does, where do you get that from, and why it is not done by the kernel ?
I read somewhere, it is not a good thing to do.

Bruce B

#4 Post by Bruce B »

Sure, the answers are in the file with specificity.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#5 Post by amigo »

Cached pages are free -that is they are available for use. Manually manipulating the Cache would rarely be good idea -the kernels management is superb. Folks who are recently-converted from windows are often concerned about Linux's high usage of RAM. But this is normal and as it should be. the kernel retains pages in the cache until it really needs to space -this avoids expensive writes to swap space -expensive both in terms of disk life and CPU cycles.
You can simply subtract the cached size from the output of the free program in order to get a better idea of the total amount of RAM available.
That said, congrats on a possibly-useful utility for some occasions if the user heeds the advice about running sync first.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#6 Post by amigo »

Cached pages are free -that is they are available for use. Manually manipulating the Cache would rarely be good idea -the kernels management is superb. Folks who are recently-converted from windows are often concerned about Linux's high usage of RAM. But this is normal and as it should be. the kernel retains pages in the cache until it really needs to space -this avoids expensive writes to swap space -expensive both in terms of disk life and CPU cycles.
You can simply subtract the cached size from the output of the free program in order to get a better idea of the total amount of RAM available.
That said, congrats on a possibly-useful utility for some occasions if the user heeds the advice about running sync first.

Bruce B

#7 Post by Bruce B »

This is not what I wanted. The only way I could think of is to make it a non executable text download with a txt extension - for the purpose that people would read it. Credits, reference, explanation everything.

The only thing I didn't say with specificity is the sentence below. It must have seemed too 101 for me to mention it or consider it.

Caching is a good thing to do, especially when it is done as well as the Linux Kernel

The reason why it is good is; RAM is fast and by caching, it saves the workload of excessive re-reading same data. The fundamental principle is; if the computer read data from disk to RAM one time, it's likely to read the same data again. If you have RAM to spare, by caching data, it should, increase speed and efficiency. It is not perfect math because, maybe your computer will read a specific application one time, or perform a function in a session and that won't ever be used again. The computer can't predict what you will do in the future.

It may cache data, it won't use again. But even this, is not a problem. The reason why, is because it will drop the data from cache to make room for a new processes. In other words, it's all very fluid, the OS is not married to its caches. It just tries to make things faster and more efficient by maintaining caches in RAM. In the case of Linux, it likes to keep lots of cache.

-----------------

Amigo of course the script syncs - you did read it before the commenting didn't you?


The only purpose in my taking the time to share this script with all the remarks and references is helping you guys get accurate memory read information.

My purpose is not to reduce ram caching, this is not implied. That was the best I know how to communicate - cannot do better than that.

Bruce B

#8 Post by Bruce B »

linuxcbon wrote:I tried it too.
Can you explain what it does, where do you get that from, and why it is not done by the kernel ?
I read somewhere, it is not a good thing to do.
Although the purpose of my post was missed. I wish to refute what
you read somewhere.

I read somewhere that it's a non destructive thing to do. In different
words - no harm in doing it.

If this were a debate this would put us even. We both read
something somewhere.

What we read has different implications.

What distribution I discovered using was acknowledged in the text
file you read.

Andrew Morton the kernel maintainer published it and the
publication has circulated.

It was published (signed off by him?) on 2005-12-22

The feature seems to have been implemented, after signing it off,
and implemented in version 2.6.16, and later, as mentioned in the
parent.

I won't post the code, but will publish the bash instructions and
comments for anyone who wish to make their own script.

Code: Select all

+ drop_caches
+ -----------
+
+ Writing to this will cause the kernel to drop 
+ clean caches, dentries and
+ inodes from memory, causing that memory to become free.
+
+ To free pagecache:
+	echo 1 > /proc/sys/vm/drop_caches
+ To free dentries and inodes:
+	echo 2 > /proc/sys/vm/drop_caches
+ To free pagecache, dentries and inodes:
+	echo 3 > /proc/sys/vm/drop_caches
+
+ As this is a non-destructive operation and 
+ dirty objects are not freeable, the
+ user should run `sync' first.
+
+
+  2.5 /proc/sys/dev - Device specific parameters

The bulk of this, was also in the text file. Please note the THE kernel
maintainer's post does say it is a non-destructive operation.

If we have a discrepancy about what we read. Considering my
source and specificity involved. I want to indicate that I do refute
your source, based on my source. If your source tends to imply
that by 'not being a good thing to do' it is a 'bad thing to do'. I'd like
you to provide the source.

Kernel.org

Bruce B

#9 Post by Bruce B »

amigo wrote: That said, congrats on a possibly-useful utility for some occasions if the user heeds the advice about running sync first.
I totally do not follow your advice at all!

Neither the reason or logic if there is any!

This is over the top and out reality. I didn't at any point advise the
user run sync first. For anyone who downloaded it. I do not advise running sync first. I see no need.

Code: Select all

sync && echo 3 > /proc/sys/vm/drop_caches
Well for anyone who knows how to read code, they can decide the
need for running sync first.

Amigo as the person asserting a need to follow his advice on how
to run the script can explain his reasoning, if there is any at all.

Post Reply