Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,771,526 Members 50,031 Now Online
XDA Developers Android and Mobile Development Forum

[SWAP] Swap on Internal * v0.5 alpha *

Tip us?
 
impactor
Old
(Last edited by impactor; 2nd February 2013 at 09:32 AM.)
#1  
impactor's Avatar
Senior Member - OP
Thanks Meter 73
Posts: 617
Join Date: Jan 2011
Location: Montpellier

 
DONATE TO ME
Database [SWAP] Swap on Internal * v0.5 alpha *

SWAP on internal
Extend your RAM with very quick internal SWAP
v0.5 alpha



For the moment, the script is confirmed to work only on ROMs with the chinese x-part (or data2ext) by Atroy script only (read at the end of this post for alternative).
The only ROM I am aware of using this script out of the box is the excellent MIUI XJ x-part.
However, I intend to develop a non-loop based version shortly. It should will be compatible with most ROMs, so stay tuned.


What and Why
I decided to make a script that places the swap file on internal memory. Many people place it on SD card, but to me it seems somewhat pointless, as it hardly offers sufficient performance.
However, placing it on the internal memory makes it a much more interesting concept, because it has much better random read/write performance than even the fastest SD cards.


Warning: placing SWAP on internal memory will subject it to frequent read/write operations which in theory shortens lifespan of internal memory chip which you cannot replace. This is because flash memory has limited number of write/read cycles to it. So, consider yourself warned.


HOWEVER:
1 - although true, in reality I have been unable to find any case of this actually affecting anyone's phone. There is very limited amount of data documenting real-life effect of that process, but most likely your device will be long gone before the internal memory will show any signs of wear.
2 - the script recreates the swap file on each boot using different physical blocks of memory - this means not the same blocks are always used. More on this in 'Do it right' section.



Do It Right

1. 16-32 MB of swap should suffice. If you think you need more, you are probably wrong. NEVER use all available internal space. The larger the proportion difference between swap size and total free space on the internal data partition, the more breathing space your internal memory gets, as this allows the swap file to be moved around upon every reboot, which, in turn, will make it use the same blocks more rarely, and thus extending memory chip lifespan.

2. Get rid of bloat you don't use from the system partition, ie: ringtones, live wallpapers, useless system apps. Then create a custom
hboot with smaller system partition and larger data partition. You can do it using this (also attached to this post).

3. Play around with swappiness parameter. Still, the default set by the script should serve you well. But if you are paranoid, you can use it to further decrease how often system will write to swap.


Removal
Disable execution flag on the scipt in /system/etc/init.d and delete swap.img from internal data directory (on x-part scripts it is /mnt/asec/mtddata/ )



Quote:
v0.5 alpha
* first public release
* loop device version only

x-part Impacted script (80% chance of rendering your ROM unbootable)
I attached a data2ext script which should offer better performance and battery life than some other a2sd scripts.
You are free to try and flash it on your ROM, but there is a good chance it won't boot any more - this is a very alpha version and I am not working on it at the moment.
Do not post complaints about it here. I only want to hear from you if it works!
S4 Mini i9195 HTC Desire
[dev] Fast swap on internal (for HTC Desire)
The Following 6 Users Say Thank You to impactor For This Useful Post: [ Click to Expand ]
 
abaaaabbbb63
Old
#2  
abaaaabbbb63's Avatar
Recognized Contributor
Thanks Meter 2942
Posts: 3,733
Join Date: Nov 2011
Location: Somewhere Over The Rainbow
Default Re: [SWAP] Swap on Internal * v0.5 alpha *

So this allocates a part of your internal memory for random access? Nice.

I personally don't need more RAM, but this could be useful.
 
Androidmarketuser
Old
(Last edited by Androidmarketuser; 1st February 2013 at 05:13 PM.)
#3  
Androidmarketuser's Avatar
Senior Member
Thanks Meter 192
Posts: 303
Join Date: Oct 2010
This sounds really good to my ears
I will keep an eye on it.
Edit:
A small question:
So is it possible to use this for any rom if you are using data2ext for it?
Or atm only for miui xj?

If you are also annoyed by advertisments on XDA, please comment in this thread: Intrusive ads? Post here!
My work:
SLIM FACTORY V4.0
SUPERCHARGER V6 GUIDE
 
impactor
Old
#4  
impactor's Avatar
Senior Member - OP
Thanks Meter 73
Posts: 617
Join Date: Jan 2011
Location: Montpellier

 
DONATE TO ME
Quote:
Originally Posted by Androidmarketuser View Post
A small question:
So is it possible to use this for any rom if you are using data2ext for it?
Or atm only for miui xj?
You have to use Atroy's data2ext, which is virtually impossible to obtain because it was developed as part of chinese MIUI rom and never released as a separate script.

However, I have been working on it and I am attaching an alpha version of my adaptation of this script to the first post
Let me know if it works, but there is a good chance your ROM will not boot any more.
S4 Mini i9195 HTC Desire
[dev] Fast swap on internal (for HTC Desire)
The Following User Says Thank You to impactor For This Useful Post: [ Click to Expand ]
 
Androidmarketuser
Old
#5  
Androidmarketuser's Avatar
Senior Member
Thanks Meter 192
Posts: 303
Join Date: Oct 2010
Quote:
Originally Posted by impactor View Post
However, I have been working on it and I am attaching an alpha version of my adaptation of this script to the first post
Let me know if it works, but there is a good chance your ROM will not boot any more.
Thanks for your answer
I tried to install it on CM10 by vj but it didn't work. Here are my steps:
Wiped everything except sd
Installed rom, then data2ext script and finally the swap script.
I'm on a ext4 partition if it matters.
I think (not really sure) one script has created two folders: /data/ and /data-app/ on sdcard.
Or did I just install it the wrong way?

Edit: The problem was as you expected that it stucked at HTC bootlogo.

If you are also annoyed by advertisments on XDA, please comment in this thread: Intrusive ads? Post here!
My work:
SLIM FACTORY V4.0
SUPERCHARGER V6 GUIDE
 
impactor
Old
#6  
impactor's Avatar
Senior Member - OP
Thanks Meter 73
Posts: 617
Join Date: Jan 2011
Location: Montpellier

 
DONATE TO ME
Quote:
Originally Posted by Androidmarketuser View Post
Edit: The problem was as you expected that it stucked at HTC bootlogo.
If you want to try x-part script, then do not flash swap script until you confirm the x-part rom works.
Try with some GB rom. Maybe you'll have more luck.
S4 Mini i9195 HTC Desire
[dev] Fast swap on internal (for HTC Desire)
 
Androidmarketuser
Old
#7  
Androidmarketuser's Avatar
Senior Member
Thanks Meter 192
Posts: 303
Join Date: Oct 2010
Quote:
Originally Posted by impactor View Post
If you want to try x-part script, then do not flash swap script until you confirm the x-part rom works.
Try with some GB rom. Maybe you'll have more luck.
I'll try it out that way on JB first (I am addicted to the new design, can't go back), if it doesn't work I will try it out with 2.3 anyway.

---------- Post added at 08:45 PM ---------- Previous post was at 08:31 PM ----------

Ok on JB the data2ext script doesn't seem to work, I can't boot.
I will try it out later with a GB rom, propably EuroSkank

If you are also annoyed by advertisments on XDA, please comment in this thread: Intrusive ads? Post here!
My work:
SLIM FACTORY V4.0
SUPERCHARGER V6 GUIDE
 
Androidmarketuser
Old
#8  
Androidmarketuser's Avatar
Senior Member
Thanks Meter 192
Posts: 303
Join Date: Oct 2010
Hmm still doesn't work.
I tried MW7 on Redux2 but stucks at boot logo...

If you are also annoyed by advertisments on XDA, please comment in this thread: Intrusive ads? Post here!
My work:
SLIM FACTORY V4.0
SUPERCHARGER V6 GUIDE
 
vasili_defy
Old
#9  
vasili_defy's Avatar
Senior Member
Thanks Meter 63
Posts: 396
Join Date: Feb 2011
Location: Nasik
Default Re: [SWAP] Swap on Internal * v0.5 alpha *

Custom hboot maker link from thalasmus blog is dead!
Can someone plz attach it here!

Sent from my HTC Desire using xda app-developers app
HTC Bravo S-LCD
Kernel Devs Needed ASAP 2 port K3 to Bravo
Save Earth ...and You can save yourself from the oncoming mess..
 
impactor
Old
(Last edited by impactor; 2nd February 2013 at 09:27 AM.)
#10  
impactor's Avatar
Senior Member - OP
Thanks Meter 73
Posts: 617
Join Date: Jan 2011
Location: Montpellier

 
DONATE TO ME
Quote:
Originally Posted by vasili_defy View Post
Custom hboot maker link from thalasmus blog is dead!
Can someone plz attach it here!
Attached.
S4 Mini i9195 HTC Desire
[dev] Fast swap on internal (for HTC Desire)

The Following User Says Thank You to impactor For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes