Ramdisk/swap - Galaxy S I9000 Android Development

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

Related

Sd-ext

I keep seeing everybody talking about having an sd-ext partition and how much better it
makes the phone run. Is it possible with a g2, and if so, how do you do it?
Sent from my HTC Vision using XDA App
http://forums.virtuousrom.com/index.php/topic,58.0.html
If you're running a Sense 3.0+ port I can see the need for swap but for AOSP based ROMs there's no need. We have plenty of RAM. It can actually induce lag and slow things down using it. Use compcache if you really need the extra RAM - of course it will slow things down a bit too but shouldn't be as bad.
As far as using an EXT partition, yet again you don't need it. These things were/are useful for older phones and lower end phones with limited memory and RAM. Unless you just download every app in the market you see, you should have plenty of space on your phone for all your apps. There's no performance gain by putting the apps on your sdcard in an EXT partition.

[Q] Swap/Swappiness, what is it? How to use it?

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:

[Q] Ram doesn't add up? (Not the usual question)

Hello,
So I just recently got my Nexus, and I'm really really loving it. I had a question about the RAM. I'm on stock un-rooted and I noticed I had a little less that 700 MB ram. I know that's for system or gpu or whatever so I'm ok with that.
What I'm confused about is, I'm currently using 400 MB of it. If I combine the totals from the "Running Apps" section plus what is in the "Cached" section, it doesn't come close to the total 400MB being used.
So where is the extra Ram being used from? How can I free some of it up?
I've been reading that task managers are a no-no for ICS, so I'm more curious about which apps are killing my ram.
Thanks in advance
ellimistx99 said:
How can I free some of it up?
Click to expand...
Click to collapse
Why would you want to?
killing my ram.
Click to expand...
Click to collapse
Killing it how? Using it to make you phone react faster?
beren28 said:
Why would you want to?
Killing it how? Using it to make you phone react faster?
Click to expand...
Click to collapse
Well sure in theory make the phone run faster. I imagine having more free ram available to be used in the cached application section and not the "running application section" will help make apps load quicker too. My friend had a desire and the amount of ram she had did drastically effect her phone performance.
But also because I'm curious about where is that extra 200 or so MB of ram is being used from?
Linux shares ram within apps/processes in a very complex way where even the experts have difficulty explaining exact tallies on ram levels. This is why different apps report different free ram values like os monitor vs system panel vs stock settings etc. So i wouldnt wprry about how android OS shows your ram value in settings, its not gonna add up and its a tricky question to ask.
RogerPodacter said:
Linux shares ram within apps/processes in a very complex way where even the experts have difficulty explaining exact tallies on ram levels. This is why different apps report different free ram values like os monitor vs system panel vs stock settings etc. So i wouldnt wprry about how android OS shows your ram value in settings, its not gonna add up and its a tricky question to ask.
Click to expand...
Click to collapse
Hmm alright. So basically it's not something I should worry about? It's quite a large discrepancy. I guess I'll worry about it once I have errors that are "low ram" or something to that effect.
Thanks anyway
It's the discussion like there was in the galaxy s forum. The not displayed ram is used by the kernel it self and by the GPU. And besides it's a good thing to have a full ram in Android, because then many apps are pre loaded in the ram and can start faster this way.
Sent from my Galaxy Nexus using XDA
ellimistx99 said:
Hmm alright. So basically it's not something I should worry about? It's quite a large discrepancy. I guess I'll worry about it once I have errors that are "low ram" or something to that effect.
Thanks anyway
Click to expand...
Click to collapse
Its always been like this on my android phones, i wouldnt worry. For example if you kill all current apps, you wont see free ram increase at the exact level of the total of all closed apps. Too much overlap and ram page sharing i think.
Don't worry about it. Some ROMs e. the stock ROM, don't have a seperate RAMDisk.
So, basicly, the ROM dumps some cached processes on to the RAM directly "clogging" it. If you however, have a custom ROM, eg. CynagonMod, the system uses half of the RAM it would use as a stock ROM, because cm uses a RAMDisk, which uses a minimal amount of space, on the device's memory.
But, there's absolutley nothing to worry about
Enjoy the phone and leave the RAM, as it is
Can anyone here tell me how to partition my sd card to create 1 ext4 partition to increase internal memry, 1 simple fat partition for daily use, and most importantly gto create 1 swap partition to increase my RAM and how to use it as RAM in galaxy fit ... Plz provide me a tutorial
Sent from my GT-S5670 using XDA
abhinav2196 said:
Can anyone here tell me how to partition my sd card to create 1 ext4 partition to increase internal memry, 1 simple fat partition for daily use, and most importantly gto create 1 swap partition to increase my RAM and how to use it as RAM in galaxy fit ... Plz provide me a tutorial
Sent from my GT-S5670 using XDA
Click to expand...
Click to collapse
The Galaxy Nexus doesn't have an SDcard. You can't partition it up like that.
Also, think you're in the wrong forum.

[MOD/EXPERIMENTAL] almost double your RAM

So, it turns out the /preload partition is 500 megs of almost unused space, just to show us a video of Asphalt. So, how about turning it into swap space to almost double the effective amount of memory you have? To use this mod, you must be rooted, and have busybox installed. I recommend the stericson busybox installer https://play.google.com/store/apps/details?id=stericson.busybox&hl=en
I would like feedback on whether or not it actually speeds up the device, especially when running graphics-intensive games, and also effects on battery life.
How to install:
1.Be rooted.
2. Get busybox. If you don't already have it, you can get it here https://play.google.com/store/apps/details?id=stericson.busybox&hl=en
3. You must have init.d support. This is built into my NardROM but you can also flash the file attached to this post.
4. Flash the script installer, attached below. NOTE: This will wipe your /preload partition. You can make a nandroid before you perform this step but CWMR doesn't back up /preload. Back up anyway
5. If it's successful, you will see something like the following screenshot when you open a terminal window and execute "free". Notice the swap being used. If you don't have swap enabled it will read 0 available.
To disable the mod:
1. Delete the script from /system/etc/init.d
2. Reflash your Asphalt video from a backup
To disable init.d:
1. Delete /system/etc/install-recovery.sh, /system/etc/init.d (entire folder), /system/bin/sysinit, and /system/xbin/run-parts
Disclaimers:
Using nand memory as a swap can significantly reduce its life. Your phone's internal memory will wear out in years rather than decades
A lot of people argue using Android swap works against the built in memory management of the Dalvik machine
http://forum.xda-developers.com/showthread.php?t=1504774
This is awesome, glad to see people spending time on this device
Tappin' Typin'
'' /vendor '' also has 590,56 Mbyte of space..
what kind of data is there? there are some folders called ''multi_pose_face_landmark_detectors.3'' and ''yaw_roll_face_detectors.3'' ? is this the carrierIQ stuff?
After deleting everything on that partition it says 395,95 mb used, 194,61 mb free.
ludacris1 said:
'' /vendor '' also has 590,56 Mbyte of space..
what kind of data is there? there are some folders called ''multi_pose_face_landmark_detectors.3'' and ''yaw_roll_face_detectors.3'' ? is this the carrierIQ stuff?
After deleting everything on that partition it says 395,95 mb used, 194,61 mb free.
Click to expand...
Click to collapse
I think it's device-specific info for face unlock to compensate for various things like the angle you're holding the phone at and the distance away from your face. And if you'll look a little more closely, you'll find /vendor is symlinked from /system/vendor, it's not actually a separate partition. You should probably put those files back if you want face unlock to work.
Technically I just downloaded some ram
Sent from my SGH-I927 using xda app-developers app On Ics
FYI, this could be a potential source of serious slowness. Swap isn't anywhere near as fast as real RAM.
I wouldn't do this unless you're legitimately having issues you can directly attribute to running out of RAM. It may be useful as Android marches on and demands more and more RAM but for ICS we're already a good clip above the recommended specs.
Same thing I was thinking. I have more than enough RAM but if by some miracle we get something past JB that uses a lot of RAM I'll do this. Nice work on it though!
sent from my captivate glide running ICS (NardROM 0.4 Rooted)
roothorick said:
FYI, this could be a potential source of serious slowness. Swap isn't anywhere near as fast as real RAM.
I wouldn't do this unless you're legitimately having issues you can directly attribute to running out of RAM. It may be useful as Android marches on and demands more and more RAM but for ICS we're already a good clip above the recommended specs.
Click to expand...
Click to collapse
Waiting for the comparison,then
mewatashiakumoi said:
Waiting for the comparison,then
Click to expand...
Click to collapse
So with this hack having been out a couple months now, how are the reviews? Performance increase? Fewer slow downs?
pm2gonzales said:
So with this hack having been out a couple months now, how are the reviews? Performance increase? Fewer slow downs?
Click to expand...
Click to collapse
1) this is not a hack, this is a simple tweak
2) swap file is ALWAYS has a performance decrease effect, no matter what (desktop PC, android phone). The only reason of use is when the device has no enough RAM, and the background processes shall be kept elsewhere
3) android has it's own RAM managing system and methods, simply stick to that as only that will gives you the best performance and user experience
4) "slowdown" occurs when the device runs out of free RAM and starts closing background applications to give everything to the foreground app. When you close the heavy resource use foreground app witch caused android to close every possible background apps, the phone reloads them (launcher, live wallpaper, app drawer, widgets, user apps, etc...) and this is what causes a temporary slowdown, and this is unavoidable, no matter if you use swap or not.

[Q] Use Internal Storage as Virtual Memory on CM9?

Now that we can swap the space used by Internal Storage over to our External SD card, would it be possible to use the Internal Storage as some sort of extension to RAM?
We got 1.7GB of storage that's not doing much of anything. If all of it or even most of it could somehow be added on to useable memory, we could have more programs open at any one time and still not lag.
If this can be done, what's the best (safest/easiest) way to do it?
cooltrix said:
Now that we can swap the space used by Internal Storage over to our External SD card, would it be possible to use the Internal Storage as some sort of extension to RAM?
We got 1.7GB of storage that's not doing much of anything. If all of it or even most of it could somehow be added on to useable memory, we could have more programs open at any one time and still not lag.
If this can be done, what's the best (safest/easiest) way to do it?
Click to expand...
Click to collapse
Make it into swapfile, you mean?
If the kernel support swapfiles, yes it can be done ...
... BUT ...
... you will shorten the life of the Internal Storage, and possibly, significantly.
And when the Internal Storage dies... you can't replace it.
And, yes, it will die, sooner or later... it's not a question of "if" but a question of "when"... and I'm sure it will die much sooner if you put a swapfile in it...
pepoluan said:
Make it into swapfile, you mean?
If the kernel support swapfiles, yes it can be done ...
... BUT ...
... you will shorten the life of the Internal Storage, and possibly, significantly.
And when the Internal Storage dies... you can't replace it.
And, yes, it will die, sooner or later... it's not a question of "if" but a question of "when"... and I'm sure it will die much sooner if you put a swapfile in it...
Click to expand...
Click to collapse
How many read/write operations before it burns out, you reckon? Would it be more or less than a physical drive?
Coz if this was possible, it would be very nice to have 2GB mem. LOL
cooltrix said:
How many read/write operations before it burns out, you reckon? Would it be more or less than a physical drive?
Coz if this was possible, it would be very nice to have 2GB mem. LOL
Click to expand...
Click to collapse
A spinning-disk drive has no limit to its rewritability.
A very-high-quality flash memory cell can last 1'000'000 write cycles. But I don't believe that our Galaxy W use that kind of flash memory. So, a more common number is 100'000 write cycles. When you're talking about swapfile, you're talking about at least 100 swaps per day, and possibly more. If you do not tune other parameters so that Android will not use the flash unless it absolutely have to, you can easily go over 1'000 writes per day.
When the counter passes 100'000... well, I'll say prepare to buy a new phone because the internal storage is not replaceable...
_____ Galaxy W + Mutant ROM + xda app _____
pepoluan said:
A spinning-disk drive has no limit to its rewritability.
A very-high-quality flash memory cell can last 1'000'000 write cycles. But I don't believe that our Galaxy W use that kind of flash memory. So, a more common number is 100'000 write cycles. When you're talking about swapfile, you're talking about at least 100 swaps per day, and possibly more. If you do not tune other parameters so that Android will not use the flash unless it absolutely have to, you can easily go over 1'000 writes per day.
When the counter passes 100'000... well, I'll say prepare to buy a new phone because the internal storage is not replaceable...
_____ Galaxy W + Mutant ROM + xda app _____
Click to expand...
Click to collapse
So better to map that to External then, if at all possible?
Any ideas on how the system could use Internal storage to improve our Wonders?

Categories

Resources