• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

Thread closed.

Status
Not open for further replies.
Search This thread

Yank555

Senior Member
Sep 18, 2009
8,716
19,947
So what is the benefits of this fix?
Simply... Why we need this? Sorry but I didn't understand.... My bad mate

No problem ;) The thing is, we have a certain amount of RAM at our disposal, plus our devices are getting faster and faster, getting more and more cores, but not that much RAM increase.

Let me illustrate my point :

htc HD2 (my frist device to run Android) - 2009

RAM : 448 MB usable
CPU : 1 GHz Qualcomm Snapdragon (single core)

SGS3 - 2012

RAM : 778 MB usable
CPU : 1.4 GHz quad-core Cortex-A9

So CPU speed is up by way much more than RAM, and I'm not taking GPU into consideration, plus storage speed increase etc...

Now those devices tend to be used in multitasking, having many apps running at the same time.

What those need is :

- CPU power to run on (we have plenty !)
- RAM to fit in (we have little)

Now even though an APP is running, not every bit of it is really needed, so those parts can be swapped out (put into swap) freeing these memory blocks and making room for more apps to fit in RAM.

So what will this mod do for you : Allow for more multitasking

Keep more apps running in RAM at the same time, making the device snappier when switching from one app to the other.

One app won't run faster !

If now you don't have swap, Android will have to gently ask the least used app to please close (save data, and quit) to free up RAM. Now when you get back to that app, Android will have to reload it, the app will start and reload it's data.

You can see, this will take more time.

Hope this isn't too confusing :eek:
 

hefonthefjords

Senior Member
Jun 29, 2010
766
126
Livingston
I have a question before i attempt setting this up.

How do we identify which partition on the card is supposed to be for swap?
I have a 64gb sandisk card and say i make two partitions, one massive one for data and a 2gb one on the end for swap, how do i identify to android that the 2gb one is for swap? Also, what format should the partition be?

Cheers.

Sent from my GT-I9300 using xda premium
 

Yank555

Senior Member
Sep 18, 2009
8,716
19,947
I have a question before i attempt setting this up.

How do we identify which partition on the card is supposed to be for swap?
I have a 64gb sandisk card and say i make two partitions, one massive one for data and a 2gb one on the end for swap, how do i identify to android that the 2gb one is for swap? Also, what format should the partition be?

Cheers.

The script handles finding the partition ;)

All you need to do is partition your card and be sure the swap partition is :

- a primary partition
- of type "Linux Swap"

JP.
 

Yank555

Senior Member
Sep 18, 2009
8,716
19,947
I have 1gb micro sd card, so can i use whole card as swap card?

Yes, just create one partition with the size of the card, and make it a primary partition of type "Linux Swap".

But just a thought, what speed class is this card ? A too slow card might not be a good idea to use as swap device.

I'm waiting for my 64Gb card, so for now I'm running 512Mb swap on my older Transcend class 4 card, which is running fine for far. I'd not really go lower, though it's sur worth a try ;)

JP.
 
  • Like
Reactions: jnr21

paranoid2007

Senior Member
Mar 15, 2007
812
49
Will the whole swap partition be used as swap memory?

And one more thing: what happens, if you remove the external sd, while the mod is active?

Gesendet von meinem GT-I9300 mit Tapatalk 2
 

jnr21

Senior Member
Aug 17, 2007
2,909
991
Helsinki
Yes, just create one partition with the size of the card, and make it a primary partition of type "Linux Swap".

But just a thought, what speed class is this card ? A too slow card might not be a good idea to use as swap device.

JP.

There's no mention what class it is. As i remember card came with some nokia phone 2-3 yerars ago, so i think that it's pretty slow, but i will test it anyway.
 

ctrlaltdel

Senior Member
Mar 18, 2006
358
26
Hong Kong
use with extsd and internal sd swap script?

Hi,

just wonder if I can use this with the extsd and interenal sd swap mod by mattiadj?

that will be great if i can use both mod and if we can use both, where will be the swap space? still the extsd?

thanks.
 

yhrn

Senior Member
Mar 25, 2011
527
339
Stockholm
Hi,
Thank you for sharing this mod. What size would you recommend for the swap partition? I think that the general recommendation for desktop Linux is something like one to two times the size of physical RAM, depending on available disk space. Would that be reasonable for Android as well?
 

Yank555

Senior Member
Sep 18, 2009
8,716
19,947
Hi,

just wonder if I can use this with the extsd and interenal sd swap mod by mattiadj?

that will be great if i can use both mod and if we can use both, where will be the swap space? still the extsd?

thanks.

Swap will all be used, but they will have a priority (order) which you can check by typing "cat /proc/swaps" in a terminal.

I'd not use many though, you don't really need that much swap :D Just compare and keep whatever works best for you ;)

Hi,
Thank you for sharing this mod. What size would you recommend for the swap partition? I think that the general recommendation for desktop Linux is something like one to two times the size of physical RAM, depending on available disk space. Would that be reasonable for Android as well?

On Android that might be shooting a little too high. I have a 512Mb partition, but I suppose 256Mb would be fine, that is the size I used on my previous devices.

JP.
 
  • Like
Reactions: yhrn
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 76
    Thread closed.
    45
    Thread closed.
    26
    Thread closed.
    5
    -=Minfree=-

    Isnt that just forcing android to close apps to have this much free ram otherwise howelse is it getting extra ram... and u would think its closing the apps itself Because unless you change the way android works android will only restart these apps again, which then causes more lags because you have close and open and close and open.
    Is this software really that sophisticated to change androids ram management.

    Have you noticed when you close some apps yourself you go back in there and the apps restart? that depends on the apps, I would think that the software would not know which apps are going to auto restart or not as it may be different on different phones and in that case it will cause lags as the apps are restarting.


    just a thought mayb im wrong , Just by hearing about it I would think thats how it works. I would be curious to find out how it does work, if it doesnt work in the way above

    Just a few thoughts on this minfree / android task killer etc. I just picked this post to reply, but I'm actually more replying to all of those questions...

    ----

    1) What is swap ?

    • Memory is divided into memory blocks that apps can use. In Android one memory block has 4096 bytes. Each memory block holds also the information when it has been used for the last time.

      Considering this, one single app will be using many blocks. Some of those the app will be using a lot, some it won't. Take a simple card game. When you're playing, you're not using the app's settings menu, thus not using any of the blocks that hold those parts of the app.

      Swap is a process that is used in most of modern operating systems. The virtual memory management system (that's swap !) will swap out all the blocks that were not used for a certain time, this "certain time" is influenced by swappiness and a few other parameters that we can change.

      The plus is that the memory blocks that have been swapped out will free up RAM to be used by other apps, thus allowing for more apps to run at the same time.

      On the other hand, if you need a swapped out block, that will cost extra time, since it's not located in memory any more but on the swap partition, so it will need to be reloaded into RAM (possibly by swapping out another block to make room for this).

      That should give you a glimpse on the benefits and the costs of using swap.

      That should also give you an idea of why LMK (= Android's own Low Memory Killer) settings matter, since if almost no free ram is available, a swap in will generally cost a swap out first the the swap in !

      Consider swap as a way to have only part of the apps in RAM instead of having all of it, and as such allowing for more apps to run at the same time.

      BTW, it does not add RAM, you can only add RAM by actually adding physical RAM, anyone telling you otherwise is either lying or does not know what she/he's talking about ;)

    2) What does Android Low Memory Killer do ?

    • All the apps you run are put into different categories (as a degree of importance).

      Each category will have a number of memory pages (the 4Kb pages I spoke about above) limit, which as soon as free ram drops below of that limit, will make LMK start killing tasks of that category.

      So the higher the limits, the sooner it will start its blood bath and kill away, or put otherwise, the higher the limit, the more free RAM you will have at any time.

      ALMK is your guardian of free RAM.

    3) Now swap & ALMK ??? How can swap work if ALMK keeps killing away ??

    • If you understood correctly the way those two work, you will have noticed they have two different triggers :

      - LMK : number of free memory blocks per app category
      - swap : time a block has not been used

      So swap will be filled over time, by unused blocks of apps running for a longer period of time (widgets, background apps mostly, but not exclusively).

      By filling swap, memory blocks are beeing freed, so more free RAM is available.

      If more memory blocks are freed, the LMK will be triggered later, since as long as it sees enough free blocks, it's happy and will do nothing.

    Hopefully this explains to everyone how this all works, and helps you understand what is what, and why some combos work and some just don't.

    In essence, don't use too low LMK values, as low memory will induce lag, because it will either require app kills (which need resources) or swap out / swap in operation (which also need resources, less though).

    High LMK settings will not impeed swap to work, it will be used less or it will take more uptime to be used the same, since less apps can reside in memory, but with swap and given LMK settings, you will always be able to run more apps than without swap at the same given LMK settings.

    JP.

    EDIT : FAQ updated with this information as I belive it is important enough to fit in there ;)