[Q] Swap/Swappiness, what is it? How to use it? - EVO 4G Q&A, Help & Troubleshooting

Hi everyone,
I am wondering if it's possible to enable this on our EVOs and also what sort of effects would it create? From inside the "A2SDGUI" app (from dta2sd) it isn't possible for me to activate swap under "swap settings" even if I currently have my SD card partitioned with 128 megabytes in a swap partition.
Could we follow the instructions found in the link below (on post #2)?
http://forum.xda-developers.com/showthread.php?t=1349694
Physical memory can be extended using a swap partition. So when your phone (or system) starts to run low on memory, it moves some of the inactive processes into the virtual memory. [1]
[1]http://zerocredibility.wordpress.com/2009/08/24/why-android-swap-doesnt-make-sense/

Swap is, in short, virtual RAM. With swap, a small portion of the hard drive is set aside and used like RAM. The computer will attempt to keep as much information as possible in RAM until the RAM is full. At that point, the computer will begin moving inactive blocks of memory (called pages) to the hard disk, freeing up RAM for active processes. If one of the pages on the hard disk needs to be accessed again, it will be moved back into RAM, and a different inactive page in RAM will be moved onto the hard disk ('swapped'). The trade off is disks and SD cards are considerably slower than physical RAM, so when something needs to be swapped, there is a noticeable performance hit.
Unlike traditional swap, Android's Memory Manager kills inactive processes to free up memory. Android signals to the process, then the process will usually write out a small bit of specific information about its state (for example, Google Maps may write out the map view coordinates; Browser might write the URL of the page being viewed) and then the process exits. When you next access that application, it is restarted: the application is loaded from storage, and retrieves the state information that it saved when it last closed. In some applications, this makes it seem as if the application never closed at all. This is not much different from traditional swap, except that Android apps are specially programed to write out very specific information, making Android's Memory Manager more efficient that swap.
This question is hotly debated, but you almost definitely do not need swap. The only exception to this may be if the device is a first generation device (i.e. HTC Dream or HTC Magic).
Swap can give more available memory, however, class 6 SD cards are recommended and SD write wear is increased.
Actual performance depends on user memory use; you'll only see a benefit if you're consistently using up all available memory, due to any combination of inherently low device RAM, using multiple apps simultaneously, or a singularly memory-intensive app. Otherwise, the performance hit will exceed any performance gain.
How can I tell if swap/compcache is running?Go to the terminal emulator - or open adb shell - and run 'free'.
If it looks like this (with zeros in the swap line), you do not have swap
total used free shared buffers
Mem: 97932 96640 1292 0 272
Swap: 0 0 0
Total: 97932 96640 1292
Alot of the present roms floating around right now,don't use the swap partition,but its a good idea to leave something like 1GB or less for future swap initiation.

Thanks for taking the time to break this down. I was wondering myself if swap would be of any practical use. This is by far the best explanation I've seen so far.
Sent from my PC36100 using xda premium

I use a small swap partition(48mb) using swapper activator for when I'm playing certain games and need other apps to stay where I left em when I switch back
We are legion, for we are many.

Will ram expander help my infuse 4g play games better?
Sent from my SGH-I997 using Tapatalk 4 Beta

best explanation so far:good::good:

Related

Low memory help!

I am fully rooted and running toasted delight beta 2 rom. I like to use a task manager and kill my programs every hour or so. How ever my free memory was about 170 or so. Now its 70mbs. What do I do other than restart my phone?
from my evo son!
In my opinion, I wouldn't worry about it. Task killers do not even seem necessary unless you are getting FC's or very bad performance because of a lack of memory (it would have to be at 30MB or less to reach a critical level)
Android memory management can usually do a pretty good job handling all the applications you have open, if memory runs low it begins a procedure of terminating the app's you have not used in a while, freeing up more space for newly opened apps (you can think about it like a stack really)
Android also performs something along the lines of pre-loading commonly used apps into memory. Even if you are not using the app, if it is commonly used then it can get partially loaded into memory. Thus, if you use an app killer to kill off an app or service, if you commonly use the app then android may still be loading it into memory (and therefore it will bring your total memory down).
anyone with corrections please do
having unused memory = worthless. In fact, I use a memory management prog to set any custom rom back to default memory management settings (off the top of my head something like 24mb of unused memory left is when it goes in to action).
I think this is a windows vs linux type thinking... I've noticed that, ever since I switched to linux I've gotten used to the fact that my OS is prepping things for the future (i.e. preloading stuff into memory that it thinks I will need). In the end it makes the system much snappier.

Ramdisk/swap

What are the possibilities of using our 2gb of ddr program storage and re allocating it as system ram?
Even if it isn't pure flash (slow speed) I imagine it would be better then nothing, we could always store programs on the sdcard.
Sent from my GT-I9000 using XDA App
android53 said:
What are the possibilities of using our 2gb of ddr program storage and re allocating it as system ram?
Click to expand...
Click to collapse
very good, this post actually explains how to make a swap file (on /cache which is fast nand!).
if you want a swap partition you could a) use part of the 2gb /data partition for a new swap partition which you create in a project-voodoo like manner -> not very easy to do as you would have to repartition /data before boot OR b) just make a 2nd partition on your external sd card to swap on. a lot of people (me included) actually did this with their htc magic.
but to be honest i don't think that you will gain any speed improvements with this, on the contrary your system will be slower an more laggy... i found swap even worse on the magic with ~90mb of user-available-ram. if you want to try it nevertheless, it think the swap file on /cache would be a good start!
jodue said:
very good, this post actually explains how to make a swap file (on /cache which is fast nand!).
if you want a swap partition you could a) use part of the 2gb /data partition for a new swap partition which you create in a project-voodoo like manner -> not very easy to do as you would have to repartition /data before boot OR b) just make a 2nd partition on your external sd card to swap on. a lot of people (me included) actually did this with their htc magic.
but to be honest i don't think that you will gain any speed improvements with this, on the contrary your system will be slower an more laggy... i found swap even worse on the magic with ~90mb of user-available-ram. if you want to try it nevertheless, it think the swap file on /cache would be a good start!
Click to expand...
Click to collapse
If we go for b, will the sgs detect and use the swap partition or do we need to do something else.. I still use my htc magic along side my sgs
Sent from my GT-I9000 using XDA App
i have tried using a swap file, but i didnt c any improvements, and the usage was about 500kb only
I recall that on liquid we managed to use a ramzswap module, which fakes a zipped swap partition in ram. It causes cpu to work a bit more, but it was still efficient.
Elvoski said:
If we go for b, will the sgs detect and use the swap partition or do we need to do something else.. I still use my htc magic along side my sgs
Click to expand...
Click to collapse
you would have to repartition our external sd to have a second (linux swap) partition.
then use mkswap to set the partition up and after that call swapon. swapon has to be redone every time you restart but you could place it in a playlogos1 script to automate that.
captive said:
I recall that on liquid we managed to use a ramzswap module, which fakes a zipped swap partition in ram. It causes cpu to work a bit more, but it was still efficient.
Click to expand...
Click to collapse
compcache?! ... i guess this would also be a good trade off for our galaxy s because the cpu is definitely not the bottleneck here...
btw. a good read about swap & compcache from the cyanogenmod wiki: swap & compcache
android53 said:
What are the possibilities of using our 2gb of ddr program storage and re allocating it as system ram?
Sent from my GT-I9000 using XDA App
Click to expand...
Click to collapse
Bad, bery bad idea, MoviNand is not in any way releated to DDR. It's waaaay slower.
Also, RAM is designed for virtually unlimited data read/write counts.
NAND memory is not.
What would be the benefit of using swap space? Nothing. Data is being read/written in filesystem in the end. No improvement in performance. (It could be seriously degraded).
This behavior is totally against Android core design principles. Android doesnt use swap because it doesnt need to. Programs not fitting into "RAM" are being closed with their state remembered. When program is re-launched it is loaded from filesystem and its state is being restored.
If we had "swap" space, it would become really messy. Just imagine:
System wants to close program X, resident in swap, it needs to:
- restore program from swap to RAM (talk about additional ram needed)
- close program, resulting writing state to FS.
i was talking about this sort of thing with Ryza and Voodoo guy they said it was too much work
i'm forward with the idea of using a Swap drive in RAM or external SD
to prevent over usage on the internal SD
This means external SD would need to be powered up at all times -> battery drain (it is present with APPS2SD - or whatever this name was)
Wuld this mean that we would have extra ram available for running apps...like SGS task manager will show more than 311Mb RAM ?
If this is the case then I am very interestied, since I don't care about speed so much. I just need to run an app that currently can not run due to out-off-memmory (needs 130Mb of RAM) for pure presentation purposes
There is a app in market called swapper2 which can make use of the swap partition or creates a swap file for use. I had been using this app since my HTC MAGIC and now on SGS.
I'm currently using swap partition that had been created earlier in my class 6 SDCard. Works on both eclair or froyo kernels on SGS. So far I am not complaining, with swappiness 20, there is not much of memory hog or lag due to opening too many apps or single memory hogging apps (like flash on browser) on my XXJPK, the swap memory gets allocated and deallocated as you can tell from the swapper info feature.
But the battery effects is something to think about though, sdcards are cheap so I don't mind sacrificing it. The other way is to create a swap file on the rfs and use it if you value your sdcard. The screenshot provided is a normal usage of my device with a few apps running at background (Still gonna be 300+ RAM, nothing magical about it though) and I had also used minfree tweak on the kernel.
You can try and see if it helps in terms of performance for a few days. I cant vouch for the swapper a lot as I'm using it myself - I am more uncomfortable without it though. What Xan said does makes sense but there are rare times when the things that doesn't makes sense gives us surprises.
A good read up and comments from people who had tried and used it in different scenarios...
http://zerocredibility.wordpress.com/2009/08/24/why-android-swap-doesnt-make-sense/
Sent from my GT-I9000 using Tapatalk

Why I don't use a Swap Partition anymore

I am convinced it hurts more than helps on a phone with a decent amount of memory such as the Evo.
I'm also convinced anyone talking about how swap could improve things usually isn't talking about an Evo. Most of the gushing reports of swap nirvana I have come across were written years ago** when android phones were new and had very small amounts of RAM.
Basically, what it comes down to is this:
Android has ways of managing memory.
Tons of tweaks and scripts (eg task killers, v6, juwe, carodope et al) have tried to improve upon this.
If you add swap into the mix you have a mess. They fight each other.
In my experience it adds significant, experience-wrecking lag, even on a fast SD card.
And for what?
So you can occasionally run a large app (and on an Evo it would have to be *very* large), pop over to different app, and resume the original large app slightly faster than you could have using normal memory management techniques.
For me it's clearly not worth it. If you have had a great experience with swap on an Evo I'd love to hear about it.
** some background reading for those new to swap:
http://zerocredibility.wordpress.com/2009/08/24/why-android-swap-doesnt-make-sense/
http://wiki.cyanogenmod.com/wiki/Swap_and_Compcache
https://help.ubuntu.com/community/SwapFaq
What about if you would set swapiness real low like 0-10
Then only when the extra memory is absolutely needed it would be used. I find that even using tweaks like v6 smurf ropeadope jade etc only running fairly aggressive settings keeps things running smooth. Bad part is that it kills multitasking.
In my evo running memory settings that are fairly balanced keeping recent apps that I'm using in memory will result in the odd reeboot because of low memory. Not excessively so but I usually know when its coming. It depends on how much I'm using my phone too.
How big of a swap have you played with and what swapiness settings?
What memory monitoring tools do people use?
To answer your questions, I mostly used a 64 MB swap partition, and occasionally a swap file on the main SD card partition, but did not try a large swap file on the order of 256 or 512 MB.
I also experimented with swappiness values of 0 10 and 60.
I would periodically check the output of the "free" command to see if the swap partition was even being used.
Swappiness 10 rarely seemed to cause any paging at all. 60 showed a lot of usage, but also seemed to create a lot of lag.
I used Go Task Manager to look at memory usage. I would launch a lot of fat apps (the xda app is a huge memory hog for some reason) and see if switching between them was any better or worse than usual. I don't think I ever said to myself "this is noticeably better".
For whatever reason, I can't get Go Task Manager to ever report more than 300, maybe 305 MB of memory was being used, swap or no swap.
I noticed using swap does not show any more memory is "available". I think of a swap file as something akin to a windows pagefile. It used to be pretty easy to see when you were using a lot of virtual memory in Windows, but I'm not sure I am using the right tools to monitor performance on android.
One might think running a kernel that allows swap would allow the phone to behave as if it had more memory "available" (even if a performance hit was associated in accessing the extra "memory"). I guess either this assumption is incorrect, or (my personal suspicion) other memory management strategies are baked in to my current ROM+kernel combo that already monitor memory usage and usually step in and kill things before memory usage ever gets above a certain level.

How to increase your internal Ram By Swaping

HEY XDA DEVELOPERS
today my thread is about increasing ram
Your phone’s RAM is a very essential component which plays a vital role in the speed and the performance. if you have more RAM, it means the processor have more storage capacity to process more and more temporary functioning files, and hence it can freely work which ensures the device is fast enough. But if your RAM is low, the processing power of the device is affected. Like if you have a low RAM< you won’t be able to play high end games on your Android Smartphone, or even ti might lag while doing simple tasks such as seeing a video, typing a text etc. So if you are suffering from low RAM, and want to get rid, you are at the right place. By reading this post you will be able to know how could I increase the RAM
Things before increasing RAM ::laugh:
Before you actually start out to increase the RAM of your smartphone there are a couple of things you need to know. In this post we will use a app to increase the RAM and this app requires root access to your phone. So make sure you root your phone before starting out. Also note that there are some issues with this app as roof uses a swap file that will be made on your SD card and hence used as ram but as some of the Android smartphones so not support swap file so this app won’t be functional in that case, so before starting out make sure your device supports swap file. You can check the device compatibility with swap file using this app. If it says it fits support follow the steps in the post to increase the RAM of your Android smartphone otherwise you can also increase the RAM of your smartphone using the link below and the link below will also work for unrooted users so in case you are unwilling to root your device to increase RAM you can also follow the below tutorial.
ROEHSOFT RAM EXPANDER :
This RAM expander app is one of the best app available in the play store which allows you to easily increase the RAM of your Android smartphone. So let’s begin with the process to increase RAM using ROEHSOFT RAM EXPANDER. Have a look at some of the features of this app to increase RAM of your device.
1 Swap memory file upto 4 GB ( In simple words it can increase ram by 4 GB depending on your device and memory card too)
2 Widget for PNP swap
3 Detailed analysis of your memory and details about it
4 Swappiness kernel parameter already set.
5 Very easy to use and create swap file and really simple interface
6 It will work with most of the Android devices.
Download from attached files
Pre-requisites :
Here is a list of things we will need before starting the process to increase RAM.
A rooted android phone, so if you haven’t yet rooted your phone first root your device as this method only works with root access to your device.
ROEHSOFT RAM EXPANDER app, you can get this app from play store but you need to know that this is not a free app. (though you can number of apk files for this app but most of them won’t work due to license issues but you can try them, if they worked it will be your luck ).
An external memory SD card installed on your phone.
How to Use ROEHSOFT RAM Expander :
So file the steps below to increase the RAM of your Android smartphone now.
Install the app on your device on which you wish to increase RAM
Now after installing the app choose your default language.
Now to increase RAM create a SWAP file by clicking on the SWAP Active and enabling it
After the process is finished just click on the grey colored box and activate the swap file created.
Congratulations you have successfully increased the RAM of your Android smartphone.
This increased ram will not show in the task manager but you can feel the change with the overall performance of the device which seems to be boost up. If you already have a decent ram them got might need to run some very heavy game to know the difference in performance. So I hope this post helped you in increasing the RAM of your Android smartphone.

Increasing the amount of RAM

Hello. How to increase RAM to 4-6 GB? Who can become a donor?
Sorry for my English. My Google Translate Assistant
You can't magically "increase" your hardware RAM to 4 or 6GB, but instead you can set a virtual ram environment using internal storage, which helps the hardware RAM to not force close any background apps due to no ram available, install this app (https://play.google.com/store/apps/details?id=com.allakore.swapnoroot&hl=pt_BR&gl=US) and set the space that you want to reserve for RAM swapping, you can even do it without root.
Thnx)
Unfortunately, software magnification does not solve the problem. I wonder if I can raise my memory mechanically
I know it's possible. On other devices
Android Phone User DIY Upgrades From 16 To 64GB Internal Storage
Imagine our surprise when the first smartphone with upgradable internal storage wasn't a Project Ara phone from Google, it was a Nexus 5 from LG.…
www.slashgear.com
There is some ways to upgrade the EMMC, but i dont think its possible with RAM...
Tsumetaay said:
You can't magically "increase" your hardware RAM to 4 or 6GB, but instead you can set a virtual ram environment using internal storage, which helps the hardware RAM to not force close any background apps due to no ram available, install this app (https://play.google.com/store/apps/details?id=com.allakore.swapnoroot&hl=pt_BR&gl=US) and set the space that you want to reserve for RAM swapping, you can even do it without root.
Click to expand...
Click to collapse
Hello, I installed the application in the link you gave. But I couldn't create partition for swap space. It gives an error. Is there any other method to improve the ram of my device

Categories

Resources