[Q] CM6.1, Chevy1 Kernel, Swap, and Memory Management

kschang

Senior Member
Dec 11, 2010
440
72
0
San Francisco, CA
Sort of technical question, as this goes into CM6.1 and mem management.

I have the original Droid, Verizon. I had it rooted for a while and recently finally installed CM6.1 (stable release).

Issue 1: Free memory

I am having background services constantly killed by the system whenever ANY app is loaded, with exception of map and music. I thought CM6.1 would solve it but it did for only 2 days. Both DiskUsage and Settings / SD card and storage shows like 130 out of 262 available. Yet my services are STILL getting whacked left and right.

I opened terminal emulator and typed FREE... That says I have 5-10 MB available.

Now the overall situation... I am getting tired of the system killing my services, and I really don't have that many loaded. I got Titanium Backup, Clock Widget, Juice Defender, SeePU, Screebl pro, SetCPU widget, Vlingo (then there's TTS, Bluetooth, Google, and SwiftKey, but those are required).

Just checked again: say 130MB available out 262 (well, 256). however, FREE at terminal emulator right now is 4812.

Q1: Why would the free command show a completely different result from the system?

I can guess it was more of a "snapshot", but that's a pretty HUGE discrepancy.

So where is all that free memory going?

Issue 2: CompCache and Swap

I found references to CompCache and swap file. I know they are not helpful to later phones with 512MB, but it's probably helpful somewhat on my Droid with just 256MB of RAM.

I looked up CompCache and I know it's specific to kernel implementations. The Chevy kernel (1.1 GHz ULEV) I had loaded doesn't support CompCache. Or else Cyanogen would have displayed it.

So I downloaded Swapper (the one with the green icon). Created a 128MB swap file. Then I rebooted, and tried "free" at terminal... SWAP shows ZERO.

I thought it was a problem with the program, so I downloaded the OTHER Swapper program, Swapper 2. Tried that. Got "failed to create swap file -- swapon not implemented. "

Yet every reference I see for SWAP does not mention kernel at all. All the references I see just say run the app or type in these commands at busybox/terminal and voila, SWAP!

Q2: As CompCache is kernel dependent, is swap also kernel dependent?

Is there a chart where it shows which kernel is compatible with what?
 

kschang

Senior Member
Dec 11, 2010
440
72
0
San Francisco, CA
Oops, answer my own questions...

A1: Yes, P3Droid kernel DOES support SWAP. Just put it in, and SWAPPER is working now. Dumb me.

A2: With SWAP enabled (swapper 2 defaults to 32MB), available memory still shows 130MB in (SD card and Storage) and "free" now shows 32-40MB free (main memory shows 5MB free).

(and yes, P3Droid kernel supports compcache too)

Sorry, answered my own questions. :) I'll probably do a few tests and which is more beneficial: compcache, swap, both, or neither.
 

kschang

Senior Member
Dec 11, 2010
440
72
0
San Francisco, CA
First test... 32 MB swap not enough

The "memory available" isn't working or is reporting weird figures.

DiskUsage comfirms 130 MB available out of 256, but my services are still closing left and right.

Tried 32MB swap, delayed problems, but it still happened. I've bumped it up to 128MB swap... Sometimes the phone's slow as heck.

I think I'll have to try CompCache with no swap, and other tests.

Can someone recommend some test apps that will eat up a big chunk of memory?
 

kschang

Senior Member
Dec 11, 2010
440
72
0
San Francisco, CA
Slight update

My apologies if this is an FAQ.

The "memory available" shown in ATK seem to be more accurately reflecting the numbers I get from the "free" command.

The "internal storage available" in "SD card and storage" under settings and "diskusage" aren't showing ANYTHING useful. it seem to be showing basically what's left after all the Move2SD was done.

Strangely, this only happened AFTER my CM6.1 update. Under the stock ROM, DiskUsage actually shows "System" taking up like 30+ MB in internal storage. Under CM6.1 there was no "system" taking up anything.

Is CM6.1 managing memory differently or interacting with DiskUsage differently?
 

kailapis

New member
Jan 30, 2010
1
0
0
DiskUsage measures the usage of storage on your phone/SD. This is akin to a hard drive on a PC.

"free" and "memory available" measures the available memory on your phone. This is the phone's RAM, which is a separate thing from storage.

The reason that your apps/services are being killed is because you do not have enough available memory (RAM) and has nothing to do with storage.
 

kschang

Senior Member
Dec 11, 2010
440
72
0
San Francisco, CA
Got that, thanks. I guess I am just confused on the following:

1) DiskUsage and "settings / SDcard and Storage / Internal storage available" shows what's "left" in internal memory 'storage-wise', but not the "OS free mem". Right?

2) Then what is the "memory available" shown in ATK Froyo? (or SeePU?) Usually shows 30MB, up to 60MB if I kill a few things in ATK.

3) So far the most accurate mem count is the one provided by 'free' in Terminal. That number is consistently TINY (a few MB)

4) And what are the numbers shown at the bottom of the "Manage Services" screen? I know the numbers on the right (in the "green") are all the services added together. I am going to guess that the numbers on the LEFT (red) would be the system process (phone, and system?)

5) And how does this match up with the OOM/Lifecycle?

I was looking at the output from WatchDog Lite / Auto Memory Manager (under running processes) but the "memory used" in those readings seem to be way larger than it should be. Every app seem to be taking 12-20MB, and there shouldn't be memory available to load them all. :)

I guess I'm just trying to figure out where did all my memory went, since none of the numbers seem to add up to me. :confused: :eek:

(The overall problem is I'm trying to figure out why my background services keep getting killed by the system from, as you said, lack of memory. I already got rid of just about everything, even Flash, from my Droid)