Question about swap and internal G1 memory - G1 Q&A, Help & Troubleshooting

Im new to all this swapping stuff etc. so sorry if this is a stupid question. When i type the free command I see that my phone memory is also almsot used up with like 1000-3000k being frees and my swap memory only being half way used (i set it to 64 mb) is there a way i can make the swap be the primary source of memory?
Hope that made sense, Thanks in advance!

No, you can't set virtual memory to have the priority. If you have a user.conf and userinit.sh you can change the swappiness value, which I'm assuming would mean more virtual memory is utilized.

Related

G1 RAM - How Used by Running Programs?

I've done a lot of searching and haven't been able to find a clear answer on this one.
Just so terminology is clear...a standard computer running an operating system stores applications on a hard drive. When a user runs a program, it is loaded into physical memory/RAM and executed. A multi-tasking OS running on a computer with a single-core CPU will hold more than one program in physical memory and switch between them such that, to the user, it seems that more than one program is being executed at the same time.
Now, on the G1, there is 192MB of SDRAM, of which about 71MB is available for storing user-installed applications. I'm assuming this is analogous to the hard drive on a standard computer--along with the 256MB of flashable ROM for the operating system, etc. So, when a user runs a program, where is it loaded? In other words, what is the analogy to the physical memory on a standard computer? Is it part of the 71MB of RAM used to store applications? If so, if I use the entire 71MB of RAM to store applications, will I have no physical memory left to run apps?
And, if I root my phone and move all my apps to the SD card, does having the entire 71MB of RAM free allow me to have more programs open and running, analogous to having more physical memory/RAM installed on a standard computer?
Thanks much for the info!
Let's clear up terminology some more.
The G1 has 256MB of ROM (Storage) with ~71MB left after install of the stock image. The remaining 60-80MB (depending on ROM) is what is used by default to install apps and for purposes of cache, acting in the equivalent purpose to a hard drive. If you use Apps2SD this is the storage you are extending.
The G1 has 192MB of RAM. This is used to run the programs and base OS. When RAM runs low the Android OS will close programs to free up enough memory to allow the foreground application the memory it needs. If you create a swap file or swap partition this is the memory you are extending.
I hope that clears it up.
Ah! So that's what I was missing. I didn't realize that the 256MB of ROM was the "hard drive" for the G1. That makes a lot of sense. Thanks much.
JanetPanic said:
Let's clear up terminology some more.
The G1 has 256MB of ROM (Storage) with ~71MB left after install of the stock image. The remaining 60-80MB (depending on ROM) is what is used by default to install apps and for purposes of cache, acting in the equivalent purpose to a hard drive. If you use Apps2SD this is the storage you are extending.
The G1 has 192MB of RAM. This is used to run the programs and base OS. When RAM runs low the Android OS will close programs to free up enough memory to allow the foreground application the memory it needs. If you create a swap file or swap partition this is the memory you are extending.
I hope that clears it up.
Click to expand...
Click to collapse
Your answers is right and thanks for the useful information. I have one question though!! when I install any ROM and do a "free" command on terminal, it tells me total memory 97MB, free memory 3MB or 4MB etc.
I want to know that G1 has built in 192MB ram then why it shows 97MB only? where the rest goes?
ibraheeemz said:
Your answers is right and thanks for the useful information. I have one question though!! when I install any ROM and do a "free" command on terminal, it tells me total memory 97MB, free memory 3MB or 4MB etc.
I want to know that G1 has built in 192MB ram then why it shows 97MB only? where the rest goes?
Click to expand...
Click to collapse
On the EBI0 HTC Dream there is to my knowledge the following:
8MB @0x00000000
32MB @0x02000000
110MB @0x10000000
------------------------
150MB accessible by linux
102MB (103MB with my recent patch) is general purpose (~5MB reserved by the kernel allowing you to see the 97/98)
48MB (or 47MB) are either in small holes or used for hardware communication or other special tasks (video ram, camera ram, memory log buffer ect)
42MB not listed is used by the radio firmware; that controls access to the entire device

Some Clarifications About Memory

Hello,
I would like someone to clarify to me some things about the device memory. My current mem readings as shown in the Control Panel are:
- Storage: 299.01 MB (210.27MB free)
- Program: 183.73 MB (72.87 free)
According to the official specs, the Topaz has 512 MB ROM and 256 MB RAM. How are these two types of memory related to Storage and Programs? Is there a way to mess between RAM, ROM, Storage and Programs in order to achieve optimum memory usage? For example, in my device there seems to be a lot of free Storage Mem available, as compared to Program Mem... Should I need to do something about this big discrepancy?
I would be grateful if someone clarified all this to me.
To be very short:
ROM (Read Only Memory) is where bootloader and Windows resides:Beside this there is more room to install applications (Programs) and to store personal files such as pictures,videos,mp3,docs etc.(Storage). ROM is non-volatile memory, this means that data will remain in the device even if power is cut off and will be available the next restart.RAM (Random Access Memory) is volatile memory that your device needs for ordinary functioning (loads into it programs that are running).RAM wil be emptied if powered off. It does not have sense to compare these two values and try to make them similar. An advice would be to install and store all you can in the Memory Card.Note: some apps/cabs need necessarily to be installed in the device (Programs memory) otherwise they don't work.Note 2: Access timings to memory cards are higher than internal ROM, take it in consideration if you have to decide where to store/install.
...Well I wasn't so short..I'll try it again:
If someone asked me:""why do I have so little free Program memory compared to Storage memory?"
I'd answer:"It's beause of many useless Microsoft programs embedded into Windows that cannot be uninstalled, only cooks can do it"
Thanks a lot for the (not so short after all! ) reply! So, if I get it correctly, the so called Storage Memory is the ROM after all: In other words, these 210 MB that are free cannot be utilized by me in any way, unless of course, I switch to a cooked ROM that contains lots of programs that currently occupy my RAM, and which they will not be needed to be installed there any more.... However, I am not in the mood of flashing and setting everything up from scratch, right now....
The storage card is indeed a solution, yet it has the two limitations that you correctly mentioned... So, I will basically have to stick with the RAM that is left...
In the same order as your arguments:
-Those 210 MB CAN be used by you, by installing apps in it, but I adviced you to possibly install them in Memory Card unless inevitable.
-Cooked ROMs generally free up Programs Memory area (or maintain same memory and upgrade embedded apps).
-Storage card is simply VITAL,access timings and transfer speeds are good enough to support everyday use.
-Then you talk about RAM: You "have to stick to RAM that is left" as anybody,but RAM usage is variable, depending on how much intensive is your device work in runtime. To optimize RAM memory use CleanRam, you can do it manually or schedule it (like I do)...and of course don't run too many apps at the time (check Task manager)!!
jcan said:
Hello,
I would like someone to clarify to me some things about the device memory. My current mem readings as shown in the Control Panel are:
- Storage: 299.01 MB (210.27MB free)
- Program: 183.73 MB (72.87 free)
Click to expand...
Click to collapse
I was talking about these 210 MB, which are reported as free in my Storage memory, which if I understood well is the ROM... So I can't use them to install apps in it.
On the other hand, the Program memory (which I have 73 MB free) is the RAM, right?
Or I've got it all wrong?
210 MB is part of the ROM and it is free space in which you can store personal files (mp3,pictures,videos,contacts,docs etc.)--->same as Memory Card but smaller and quicker.The free memory in which you can install programs is in your case 72.87MB and is still part of the ROM(I want to better check this last statement,update coming soon).
RAM is another memory module,physically separated from ROM,it's another chip. RAM values vary with the device workload.
Update: I confirm,to simplify we can say that both Storage and Programs memory is part of the ROM, in no ways it can be considered as being RAM.
Thanks a lot for all the clarifications, sualc! Now everything has been sorted out to me.
You're welcome,cheers

Compcache / Linux-swap

Run sh /system/bin/swap -s to check swap status and other mod values.
Ok so I did this to check on my stuff, cause i wanted to make a compcache.
*** CompCache ***
compcache_en=0
cc_memlimit=16
cc_disksize=32
cc_backingswap_en=0
cc_backingswap=/dev/block/mmcblk0p3
swappiness=30
*** Linux Swap ***
linux_swap_en=1
linux_swap_partition=/dev/block/mmcblk0p3
....................
=== Linux Swap status ===
Linux SWAP enabled on /dev/block/mmcblk0p3
Linux Swap: swappiness - 30(system) 30(user)
i'm running JACxHEROSkiv1.5r2 and want to know what I can do to inprove the speed of the ROM.
Any suggestions are welcome i'm not much of a programmer
Looks nlike you need to edit the"cc_disksize=32" value, but I doubt that affect the speed tbh.
What size swap partition are you running?
Im running with 96 MB linux swap
btw what is that (cc_disksize=32) ?? the linux swap size ?
I read i a couple of posts about the linux swap and compcache and read that if you enable comcache it could speed up your device slightly.
YuYe said:
Im running with 96 MB linux swap
btw what is that (cc_disksize=32) ?? the linux swap size ?
I read i a couple of posts about the linux swap and compcache and read that if you enable comcache it could speed up your device slightly.
Click to expand...
Click to collapse
Ah thought CC was already enabled.
compcache_en=0 < This needs to be changed to one to enable CC.
cc_disksize=32 < That's the CC size, I wouldnt change it.
I would *strongly* recommend reducing your swap size. It seems to be that the bigger the size, the faster it is at first, but then the phone starts to get really slow. Go for 48 or 64mb.
I don't really know a lot about CC, I've never edited the config files for it as it's generally set up for optimum performance already (and I also don't like the idea of it wearing out the nand). If you look in the xHero there are other configurations for CC, CC+swap, swap, CC +backing swap that you may want to look at.
twistedUmbrella said:
Alright. Ran a 96 mb swap all day to test. Load screen about equal. It was "ghost lag" where you do something and it freezes for a minute
Click to expand...
Click to collapse
Ok then i better change the size of my swap. also does it matter if your on ext3 or 4 ?
And what is the difference between linuxswap and compcache ?
Sorry for these noob questions but I'm a bit lost
YuYe said:
Ok then i better change the size of my swap. also does it matter if your on ext3 or 4 ?
And what is the difference between linuxswap and compcache ?
Sorry for these noob questions but I'm a bit lost
Click to expand...
Click to collapse
no ext doesn't matter.
Compressing pages and keeping them in RAM virtually increases its capacity. This allows more applications to fit in given amount of memory.
Click to expand...
Click to collapse
The problem is the Hero UI is quite CPU intensive, so less CPU power can be devoted to compressing/decompressing files in RAM.
Linux-swap is a separate partition where files are paged, increasing the amount of memory. The difference being it's outside the RAM.

can someone tell me if my thinking is correct

ok so i didnt really know what swap was or compcache with backing was so i spent the day lookin it up and i just want to know if what im getting out of my info is correct.
swap, basically instead of your phone just seeing ram it also sees your swap partition as part of the ram. so it stores app data and etc. to the swap partition thus making your phone run faster and not taking up all your internal ram and make it run slower. and it is managed by linux. by changing your swappiness setting either higher or lower will change how often swap is used.
compcache, basically creates a sort of swap partition inside the ram itself. it compresses what it swaps into this partition to create more space in the ram. im guessing people like this with backing swap because the compressed info can be brought up quicker because its compressed in the phones ram rather than like swap were its on the sd.
backing swap, when compcache is full it uses the swap partition on my sd. but rather than being like linux swap were its controlled by linux, backing swap is managed by compcahe wich works together better than compcache and linux swap.
im a complete noob here lol so if i got something wrong you gotta explain it to me in laymans terms thanx for the help
Yes, that's right. Did you copy and paste those definitions lol?
lol no i did a lot of google searching its all other peoples info but i put it into words that i can understand.lol
Amack that almost deserve a sticky
this post help me understand the way the partition works alittle better now, thanks!

Compcache + Swap - Sorry guys....

Sorry for posting another question relating to this.. I'm having a heck of a time trying to wrap me head around...
ROM: Cyanogen 4.2.10.1
I have a 4GB class 6 SD card in my phone partitioned (rounded):
3300MB fat32
500MB ext3
200MB swap
I'm have the userinit.sh in /system/sd as
Code:
#!/system/bin/bash
#
partition=3 #partition number of swap partition. Change if swap is not partition 3.
mem_limit_kb=14688 #default 14688 (15%). Range 0 - [size of swap partition], larger number = less 'normal' RAM, more 'swap' RAM
swappy=30 #swappiness. larger number = more likely to swap, smaller number = less likely to swap
modprobe ramzswap;
rzscontrol /dev/block/ramzswap0 --backing_swap=/dev/block/mmcblk0p$partition --memlimit_kb=$mem_limit --init;
swapon /dev/block/ramzswap0;
sysctl -w vm.swappiness=$swappy;
exit 0;
as per the Cyanogen wiki...
If I run "free" from the terminal I get
Code:
free
total used free shared buffers
Mem: 97924 96448 1476 0 2940
Swap: 24472 12940 11532
Total: 122396 109388 13008
What I'm having trouble understanding is "mem_limit_kb=14688". What memory is it referring to? The built in RAM?
If so, does that mean to put active programs into the remaning 80MB of RAM and store the "images/pages" of inactive applications into the 14688KB of reserved RAM for Compcache? After the 14688KB of Compcache is filled, should it not then dump everything to the Swap?
The reason I'm confused is that I have 200MB of swap partition, and yet I still load up the browser from memory and it reloads pages... Or is it reloading the page, just this time from a local cache (which would be silly)?
Finally, what exactly does "swappiness. larger number = more likely to swap, smaller number = less likely to swap" actually mean? I don't really understand that at all...
Its not a good idea having both enabled in the user.conf..One will be set as back swap while the other is be set to 1.
To be honest I have no idea.. heh. I just copied it from the Wiki.. To me it made a bit of sense running both... Compache to be first since it should be a bit faster than swap... Atleast that's how I saw it...

Categories

Resources