How about some Virtual RAM for your iPhone

By | September 29, 2009

At the risk of making my blog look like an iPhone special, here I am blogging after ages, once again about the iPhone :).

iPhone_VM

In my last post, I shared a way to increase the performance of your iPhone by removing some unnecessary stuff from it. This time the tweak involves adding a package to increase the memory and improve the performance of the applications a little better.

This application does nothing but creates a swap file on your iPhone. Most linux users must be aware of the Swap file concept, which is nothing but a special area on your storage disk allocated to be used as Random Access Memory, in case the applications need it. This swap file resides on the permanent storage and frequent reading and writing to it can sometimes prove to be very expensive in terms of performance . Hence, this concept usually works well with the applications that run in the background as they don’t need to actively use the RAM.

So how good can this be for a device like iPhone which doesn’t believe in having the background applications ? This app (like most other hacks) can be installed only on a JailBroken device and it can be very useful with the backgrounder app. Those who don’t use the backgrounder would still get the benefit as some of the important apps like, mail app and iPod tend to stay sitting idle consuming memory in the background even if you don’t use them. With this swap file installed, there is a noticeable improvement in the  available RAM for all these scenarios.

To install the app, you need to download the .deb file and install it from the mobile terminal. This doesn’t have any icon or a toggle switch (as of now). However, if you have SBSettings installed, you can notice the difference with the available RAM shown by it. Most users see a substantial improvement in the numbers. This, of course, wouldn’t make so much difference to those who have a 3GS,  as they already have more than sufficient RAM on their devices, but nevertheless they would also notice the increase in the available RAM count. The swap file is of 256 Mb, but the developer suggests that it would automatically add 256 more if its all consumed up at any point.

You can download the file from the link here : Virtual RAM/Swap file for iPhone.

For further discussions and reading, you can checkout the source link to xSellize forum.

Update 1: A few other developers have toyed around with this  concept, and have come up with an even better way to use the swap space..

The second method seems to be a documented feature for the iPhone OS, which is not active by default. There is a plist file “com.apple.dynamic_pager.plist”  which is supposed to be put in /System/Library/LaunchDaemons to get this working. Using this plist would use a built-in program to create a virtual memory swap file to be used. I’m not sure if this was something which Apple has kept hidden on purpose or it got introduced as a result of JailBreak, but the ‘dynamic_pager’ program is already on the iPhone located in /sbin.

This approach creates a dynamic virtual memory swap file ‘on demand’ without any size limit. And this seems to be less buggy than the previous version.

To use this method, download the plist file from here , put it to /System/Library/LaunchDeamons and reboot. Don’t forget to uninstall the previous VM package before using this one.

Update 2: I’ve tried using both the versions, and I like the native plist version much better. With the first Chinese VM app, it used to allow having a lot of free memory, but the phone got laggy while trying to push stuff on the swap space. It sometimes even got stuck at one screen for minutes together before getting the app to work. So it was nice to have free memory, but it didnt please me as the overall system impact was laggy.

With the native plist method, its been a smooth ride so far, no lags whatsoever. I’ve got mail app, ipod, safari running in the background and still have almost 43 MB memory, free to be used. I tried playing GangStar with it, and it was smooth, and didn’t crash even once.

Keep watching this space for more updates :)

Do let me know, if you tried using it and noticed any improvement with the performance.


15 Comments

Monsieurtalbot on November 4, 2009 at 7:20 am.

Tried it, it works great!

The new .Plist option is far better than the other iPhone VM options!

I’ve linked this page to Sinfuliphone.com

THANKS!

Reply

moja1986 on November 5, 2009 at 9:04 pm.

I’ve tried the plist method, didn’t feel any different. some system info app tell me there’s no increase of memory. can you help me to get this work? mine is iPhone 3G, OS 3.12

Reply

chuck on December 13, 2009 at 5:41 am.

I just tried the plist thing cuz I was having crashing problems like crazy, I have sbsettings and I could see my ram decreasing until there was none left at all and then it crashes.
I installed how you said, and my ram counter bobs around 29 and 30 when I have like 6 apps or more open. regardless how much crap I open it doesn’t go below. This is awesome! Thanks you solved all my iphone problems, which was just one…lol. I guess what the file does is create more ram when it gets to a certain point. I see no lag at all also. It’s flawless. Thanks again

Reply

JDEAN on December 28, 2009 at 11:04 pm.

While this hack fry tour iphne like the other VM mods

Reply

Ruben on January 7, 2010 at 3:27 am.

This is discussed heavily on xsellize too, and its common thought that this WILL FRY your RAM Chip

Why don’t you try this approach

http://xsellize.com/showthread.php/76965-Repeating-memory-free

Reply

Doug on January 22, 2010 at 6:47 pm.

So… i did this… i like it compared to not having it… but i do notice a lot of slowness while multitasking. I do wish it was a solution to having a bunch of things running. At least they don’t crash… at least not as much as before!

I just hope they figure out a way to increase the RAM amount in these things… I could use double or more what’s built in!

Reply

Riley on January 29, 2010 at 1:49 pm.

Thank you so much for writing this article. It’s simply amazing what you did. Really :-o I had a lot of problems with my iPhone 3G, 8Go. Every time it crashed, because it’s got more or less just 8-10 Mo free RAM. Now, by your plist file, my iPhone fuse :) :D I’m so happy today, thanks to you. Thanks a lot. All the best :p

Reply

lotf on February 16, 2010 at 5:11 am.

This appears to be an awesome tip, but I ended up uninstalling. Sure, my phone booted with 80MB+. But instead of freezing at 6MB< it froze at 30MB. Net gain = 0. Same performance as before. Not worth the risk.

thanks anyway!

Reply

David on November 24, 2010 at 10:27 am.

The reason why a lot of people are having VM issues on their idevices is that there are TWO files needed to properly enable the dynamic pager daemon on os 3.x and 4.x. I’ve tested this on both my iphone 3gs under 3.x and my ipad under 3.x… then again once I upgraded to 4.x

Pluse a lot of the .plist files you get on the internet do not work. THEY MUST BE A PLIST FILE IN PLAIN TEXT TO WORK!

com.apple.dynamic_pager.plist goes into: /System/Library/LaunchDaemons

A SECOND file is needed to make sure the swap files are NOT encrypted. If you do not add this file. Your device can be slow, sluggish and crash… a LOT:

com.apple.virtualMemory.plist goes into: /private/var/preferences

Here are the contents of what each file should be. Just make a plain text file and SSH them to the above mentioned places:

com.apple.dynamic_pager.plist
—————————–

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
< plist version=”1.0? >
< dict >
< key >KeepAlive< /key >
< true />
< key >Label< /key >
< string >com.apple.dynamic_pager < /string >
< key >ProgramArguments< /key >
< array >
< string >/sbin/dynamic_pager< /string >
< /array >
< key >RunAtLoad< /key >
< true />
< /dict >
< /plist >

com.apple.virtualMemory.plist
——————————

< ?xml version=”1.0? encoding=”UTF-8?? >
< !DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd” >
< plist version=”1.0? >
< dict >
< key > UseEncryptedSwap < /key >
< false/>
< /dict >
< /plist >

UseEncryptedSwap

With the above, and using backgrounder. I’ve had enough apps running to have 1GB of swap space. I read in another post someplace that someone had said the idevice pager won’t simulate ram, WRONG. It does. iOS is just a scaled down version of OS X. It fully uses the swap files as ANY OS would.

The above way will make an initial 64MB swap file. Then it will make additional 64-128 (and sometimes 256MB) files. When your device is rebooted, the dynamic pager daemon auto deletes them for you ;)

keywords: iphone, ipad, ipod, swap file, virtual memory, dynamic pager

Reply

David on November 24, 2010 at 10:34 am.

And lastly.. NO this will not “KILL” your storage. There could be SOME possibility if you ran TONS of apps at once and were CONSTANTLY “grinding” the storage area. But your device will be FAR FAR out of date before this will kill your storage (5+ YEARS).

So, the above, combined with Backgrounder and SBSettings make a WONDERFUL combination. with VM enabled, if you use SBSettings to free up ram, what it will do is use up all memory except 64MB and that forces everything else to swap. This leaves a 3GS or ipad with about 180-195MB of free memory :) … and if you use that you.. you can free it again.

Also, your memory should NEVER drop below 60-64MB with the above VM steps I posted above. When the system gets near 64MB, you will notice a little bit of lag (I have SBS display free memory at the top of the screen). The lag last only a few seconds as the dynamic pager swaps more data to storage. This is a handy thing as your device will never run out of memory.

I DO NOT recommend this for ANY device with 128MB of RAM!!! I tested this on an iphone 3G, and the performance was TERRIBLE! This is because those devices have so little ram, turning on the pager will make it CONSTANTLY grind the files. This WILL drain battery VERY VERY fast.

Reply

danish on December 2, 2010 at 12:23 am.

@David Thanks for sharing your observations and techniques with us here. I have updated and merged your comments into these two. Let me know if you still want to modify something or post a unified comment. Thanks.

Reply

igor momirovski on April 14, 2011 at 3:57 am.

did this work on 3G 16 gb firmwire 3.1.3????

Reply

Josh on May 17, 2012 at 2:02 pm.

Will this work safely with a (redsn0w) jailborken iPhone 3G (16gb) with iOS 4.2.1?
I’d really like to know if it does. I’m very much interested at trying this method.

Reply

danish on May 20, 2012 at 11:23 pm.

The method would work.. however, with 4.2.1 this may not be as effective.. as the available RAM with 4.x would be very low and every now and then, the date would be pushed to the virtual RAM resulting in too much ‘thrashing’.

Reply

Leave Your Comment

Your email will not be published or shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


six × 4 =