[TOOL/SCRIPT/RC2]FreeXplain-r / freex-BETTER than free & Why "free" RAM ISN'T WASTED!

Is this better than free?

  • Yes

    Votes: 52 96.3%
  • No

    Votes: 2 3.7%

  • Total voters
    54
Search This thread

mrhnet

Senior Member
Jan 2, 2012
325
268
@zeppelinrox
Using RC2. All ok!

I have lil suggestions, I dunno whether you like it?
1. To add a "real time monitoring" option to the tool ("watch" workaround doesn't look good, it takes time to redraw the whole screen).

2. To have something like a "background /proc/meminfo recording" option, so we can analyse the data later. I was thinking like this: http://xdaforums.com/showthread.php?p=52999513
And then "format" the data to make a graph (eg:changing of free mem/cache/buffers etc with time).. or at least creating csv file from that data so can make a graph in Excel or something..

Am I asking too much? :) you are the script master in xda ;). Anyway, thanks for your super works!
 

zeppelinrox

Senior Member
Dec 21, 2010
9,374
21,590
IN THE FREAKIN' OP
@zeppelinrox
Using RC2. All ok!

I have lil suggestions, I dunno whether you like it?
1. To add a "real time monitoring" option to the tool ("watch" workaround doesn't look good, it takes time to redraw the whole screen).

2. To have something like a "background /proc/meminfo recording" option, so we can analyse the data later. I was thinking like this: http://xdaforums.com/showthread.php?p=52999513
And then "format" the data to make a graph (eg:changing of free mem/cache/buffers etc with time).. or at least creating csv file from that data so can make a graph in Excel or something..

Am I asking too much? :) you are the script master in xda ;). Anyway, thanks for your super works!
Hmm well creating an html file that loads a google chart should be possible.
For example... https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart

The only code that needs to be changed is the data.

At least that way I don't have to rely on a 3rd party binary.

Though I wonder what kind of time interval would be suitable or preferred by most.
 
  • Like
Reactions: mrhnet

mrhnet

Senior Member
Jan 2, 2012
325
268
Nice if time interval could be customizable.. Like possibility of changing the "watch -n [value]" as needed.. if that's the way you've planned..
 

DarkAngel

Senior Member
Aug 1, 2006
639
357
Arizona
I hope it's okay for me to respond.....

Thanks for the Script....:) Just a query...Do we need to run the script at every boot...or dose it run automatically? and is there any way to uninstall?

Just set the PATH in the terminal. It hint's you in the script when it first opens up. Check the pictures posted at the bottom in the OP. As far as deleting, my only guess would be manually if you have root.


@zeppelinrox

Still rocking this and working great. :good::good:
 

Top Liked Posts

  • There are no posts matching your filters.
  • 51
    [TOOL/SCRIPT/RC2]FreeXplain-r / freex-BETTER than free & Why "free" RAM ISN'T WASTED!

    See Post #2 for Installation/Requirements/Download.

    Now before getting into my new tool, I'd like to explain why I felt the need to even bother making it.

    First of all, if you've ever typed "free" in terminal, you'd see that it shows almost no free ram while any app you check with would show lots of free ram.

    This what it looks like.

    p2pzzt3rkti5xms6g.jpg


    Now if you're like me, you'd probably do a google search to figure out what the hell it means lol
    Because I had over 200 mb "free" when I took that screen shot but that shows only 40mb free and it would be nice if it actually made some sense ;)

    Some of you familiar with my V6 SuperCharger may have read this post of mine before: "Why 'Free RAM' Is NOT Wasted RAM!"
    In there, I post some findings from my first hand experience and how it correlates with this article Linux Memory Consumption (which I had found afterwards)
    Unfortunately, that page is now down but I had a saved copy in PDF format which I've attached.

    In that pdf, it reads "The absolute free memory number is not only the value of MemFree, but the sum of the MemFree, Buffers and Cached fields."

    There are many pages that can help you figure it out.
    Here is a good one Check Linux Memory Usage Using Free Command

    If you need to know exactly what buffers and cache actually are, click the button
    Info taken from http://nilesh-joshi.blogspot.ca/2010/04/interpreting-output-of-free-command.html


    • The "buffers" column shows the amount of memory being used by the kernel buffer cache. The buffer cache is used to speed up disk operations, by allowing disk reads and writes to be serviced directly from memory. The buffer cache size will increase or decrease as memory usage on the system changes; this memory is reclaimed if it is needed by applications.
    • The "cache" column indicates how many memory pages the kernel has cached for faster access later. Since the memory used for buffers and cache can easily be reclaimed for use by applications, the second line (-/+ buffers/cache) provides an indication of the memory actually used by applications (the "used" column) or available to applications (the "free" column). The sum of the memory used by buffers and cache reported in the first line is subtracted from the total used memory and added to the total free memory to give the two figures on the second line.
    • Swap space is generally used as a last resort when the system can't reclaim physical memory in other ways.
    Another light hearted link is Help! Linux ate my RAM! That page has this table:

    sf7ap3i4mu83x4z4g.jpg


    The middle yellow bar above is referring to the buffers (91 mb) and cache (764 mb) values below (855 mb total).
    Code:
    $ free -m
                 total       used       free     shared    buffers     cached
    Mem:          1504       1491         13          0         91        764
    -/+ buffers/cache:        635        [B][COLOR=Green]869[/COLOR][/B]
    Swap:         2047          6       2041
    869 mb is readily available and not just 13 mb!
    So if you read that page, you'd know that 855 mb is NOT actually wasted, it's being used by linux to speed things up!

    Basically, if you're not using the ram for apps, linux is using it for cache instead.
    And when you need that ram for apps, you get to reclaim it instantly ;)

    Therefore...

    qa4h03xqltbb95e4g.jpg


    ======================================================

    Ok that's all nice nice but why did I bother making a new tool?

    Well, if you look at the first screen shot up top, you'll see that the android/busybox free command does NOT have the cached column.

    Therefore, the free command on Android actually tells us a little something...
    ...but whole lotta nothing!

    So, this is what I did about it...

    g60d97cz48zw8c04g.jpg


    Basically, I:

    Added the cached colum
    Removed the useless shared column (which is always 0 and is a waste of real estate)
    Added the swap -/+ adjustment line (notice that 4076 kB is actually available, not just 16 kB)
    Then total everything up nice nice ;)

    So here's a direct comparison of the 2 outputs:

    2dfxa1kmhr1uoxb4g.jpg


    I added colour to the free output for easy comparison.

    But notice how the -/+ adjustment line is COMPLETELY different.
    The free command shows only 44,644 kB as being freely available but in reality, the value is 208,352 kB... not even close! Simply because free doesn't utilize the cached value (which is found /proc/meminfo along with all the other data.)

    The math works both downwards... (add same colours to get the bold ie green plus green = green bold)
    ...and sideways ie. freely available(208352) = free(40104) + buffers(4540) + cached(163708)

    Now, not everybody like rainbows so there is an alternate colour scheme...

    oavootid2o1wg8y4g.jpg


    Of course, while I was at it (it took me nearly a month to perfect it), I added a whole bunch of options...

    a1d172soq63hl5s6g.jpg


    So let's see it actually explain something with the -x option...

    d2ux9qdr9vp9yjf6g.jpg


    And explaing even more with -r... ( it's kinda like a mini tutorial ;) )

    pecds83kact96ss6g.jpg
    ms7n9v1e0vud9vd6g.jpg


    Since it has so many options, it would be a pita to remember all the options so that you can have your favourite output format all the time...
    So it will actually remember your last command (but ignores -help and -install).
    Just type "freex" and it automagically does what you did last time...

    49twn3kvialzn6e6g.jpg


    The output is different depending on whether swap is enabled...

    k42y4ywgsh1dw4o6g.jpg
    zfdwzyk3d777mwp6g.jpg


    I added the -o option from free which omits the -/+ adjustment line and added a -total only option...

    gl0hacd391uoo7s6g.jpg
    xwm3nu13l74347n6g.jpg


    Force -wide option when not using kilobytes (and using a smaller font)...

    g4d23pg3q8r13696g.jpg


    It's nice to see the percentage table along with kB and/or mb tables.
    Also note that it automatically uses wide output when using kB.

    pe2iwvk9ighwmdi6g.jpg


    Click the button for some gratuitous screen grabs...

    r7pcy84dg9t5eyd6g.jpg


    d1ny6ds6h34p66b6g.jpg
    lwk9w3gh2j13wue6g.jpg


    5vfafovh3bd8add6g.jpg
    29
    Root is NOT required to use this script!

    However, if not root, to actually install it for easy command line usage requires a little workaround.

    Requirements:

    1. An app that can run scripts lol

    Fully compatible with Terminal Emulator and Script Manager/Script ManagerPro.
    Other terminal apps probably won't display colours properly.
    In fact Script Manager didn't either until I requested 256 colour support for it and @devwom updated it quite fast :)
    So make sure to UPDATE Script Manager if that's your preference!

    Tho it may not display all the colours, Terminal IDE will work too while installing BusyBox for itself.

    2. BusyBox (for the grep and printf commands)

    If you're rooted, then there is nothing else to do and go to the Install section.

    If NOT rooted you have a few options.
    a) download the attached busybox.zip and put it in the same place as the freex script. It is not a zip file. It's the busybox binary from Kbox2. I chose it for it's small size.
    Just run freex as explained in the install section and freex will install "busybox.zip" for you as long as it's in the same location as the script.
    b) install OneBox. It requires Terminal Emulator and automates the process to...
    c) Install Kbox2
    d) Easiest solution is probably BusyBox Non-Root but also for use with Terminal Emulator.
    e) Use Terminal IDE (has its own BusyBox)

    FreeXplain-r Installation:

    (Pronounced "Free Explainer")

    Note: Installation merely simplifies the execution of freex so that you can just type "freex" in your terminal app without having to type "sh /sdcard/freex*" all the time. Of course, if you're using a script runner like Script Manager, it doesn't matter too much since their purpose is to make it easy to run scripts.

    1. Save attached script to sdcard. (No need to rename it from freex*.pdf)

    2. Then just run the script!

    If using Script Manager, no need for me to explain how to use that app.

    If using a terminal app, do:
    Code:
    cd /sdcard
    sh freex*
    No need for the -i switch it should install automatically.

    Use the -i switch for forced installation/update/refresh.

    If not running as root, it will copy to your terminal app's data folder and give you further instructions.

    nl112jv6yh3y38u6g.jpg


    Notice that it says to run with "sh freex" in the help section?
    That's because the $PATH statement hasn't yet been setup in the terminal app's settings.

    If running as root, it will automatically install to /system/xbin and it's easy as pie.

    ufar37e7w2q3a9a6g.jpg



    Here is a forced refresh/reinstall.
    Not running as root at first but the $PATH is setup so it doesn't give the additional help info to set that up.
    Then as root, of course it installs to /system/xbin

    buqsy02kzbvy7ob6g.jpg
    4
    RC2 bugfix is up!
    Updated OP and Post 2.
    2
    This is nice!! Explains all! I like rainbows of course.. ;)

    Noted something.. when running (installing) the script saved to a folder which has a name with spaces, an error occurs (I'm using ScriptManager). "freex" didn't get installed to xbin properly (size=0). No issues otherwise.
    4cU4enUl.jpg
    2
    Another masterpiece from the GoRM!
    ok I give up... what's GoRM? IMMA N00B and forgot the URL for google.com :p

    Even for a simple(but not so simple :p) script you can explain this much. This really sums up what an amazing developer you are zep.

    Sent from my GT-P7500 using Tapatalk
    I don't bother if it don't work on all devices ;)
    This is nice!! Explains all! I like rainbows of course.. ;)

    Noted something.. when running (installing) the script saved to a folder which has a name with spaces, an error occurs (I'm using ScriptManager). "freex" didn't get installed to xbin properly (size=0). No issues otherwise.
    4cU4enUl.jpg
    Ah the scripter's life long nemesis... the evil space in a folder name.

    I shall quash that empty soul in our next duel.

    Btw you didn't update Script Manager... the rainbow is all wrong lol

    Edit: Added a poll. For fun, I'm gonna view it as an IQ test. heh.