![]() |
How to free swap memory without rebooting?
My N9 is fastest in every way when swap memory usage is lowest. Emails swipe faster, homescreens swipe faster, and I think that swap-related slowdown is one of the primary reasons N9 owners are rebooting all of the time--because rebooting resets the swap memory.
I have seen other threads that discuss complex (and admittedly risky) ways to add swap capacity to our N9s, but I have a much more simple question: How can we reset the swap memory as if we had rebooted without actually rebooting? After looking and searching I have yet to find an answer. I imagine that there must be a command that could be put in Profilematic or simply entered from time to time that would do the job, but what is it? This could be a game-changer for many users, since clean swap positively impacts my N9's speed performance as much as FasterN9 and light overclocking. Thanks. |
Re: How to free swap memory without rebooting?
Well, I don't use OC, I don't use FasterN9, and still I find the performace good all the time regardless of uptimes...
(well it's only 7 days now because I did some boot stuff back then... but generally I only boot my device when I need to change to different kernel/OS...) I do not think you need to boot your devices regularily to have good performance. If that's required, then you have misbehaving applications or you have yourself done some tuning of the device that has turned sour. :) |
Re: How to free swap memory without rebooting?
Quote:
Quote:
http://talk.maemo.org/showthread.php?t=84007 You can reset the swap by running (as root) Code:
swapoff -a A better solution would be having TWO swap spaces and from time to time swap (no pun intended) between them. This has been discussed a number of times. See e.g. http://talk.maemo.org/showthread.php?t=42357 http://talk.maemo.org/showthread.php?t=84296 http://talk.maemo.org/showthread.php?t=86752 ...and many others. Some of them discuss the N900 but the solution is actually the same for the N9. |
Re: How to free swap memory without rebooting?
I am not sure but is this what you are looking for?
http://store.ovi.com/content/258450?...e=search&pos=1 |
Re: How to free swap memory without rebooting?
Maybe Dropcache http://store.ovi.com/content/258450 help you out:
(dropcache and inception required) Code:
terminal command: |
Re: How to free swap memory without rebooting?
Thanks for the responses! I have read and researched what everyone has said and here's some feedback.
Quote:
The swap-related slowdown issue is discussed in this thread: http://talk.maemo.org/showthread.php?t=84007 I started this thread in hopes that an answer could be found to the swap-reset question. Once we have an answer, It can be merged in a solution thread. Quote:
Quote:
And thanks for the two swap spaces ideas and research threads. I'll check them out, but am still looking for a workable, easy swap reset approach that avoids reboot. Mikkosssss and Lirion, I have tried Dropcache, but as discussed in the thread discussed above, it does not seem to solve the problem of freeing swap memory (though it is very useful in tracking the problem as it shows the amount of free swap memory). Thanks again, everyone. |
Re: How to free swap memory without rebooting?
Swap memory cant be free up except booting, only way is to add more swap memory from 255 to 412
|
Quote:
I saw your earlier post, so any insight would be much appreciated. |
Re: How to free swap memory without rebooting?
Sorry I dont know why, just know many developer said CANT..I dont know the reason and the meaning, just I know is cant
|
Re: How to free swap memory without rebooting?
Quote:
Code:
N900:~# free One way of reducing the impact of swapping is spreading the bandwidth, such as one swap partition in the device and one on the SD card, as discussed in those threads that I linked in my first reply. EDIT: I am actually a bit surprised how much main memory is used before swapping occurs (or how little main memory is left free). My gut feeling would be to strive for at least 20% slack, which would mean even more swap usage. Obviously the Hildon programmers knew better. |
Re: How to free swap memory without rebooting?
I appreciate the effort, but I don't think that I am being clear enough, so please let me try to restate the problem.
(1) We all agree that when you reboot the N9, there is 255 MB of swap available out of a total swap size of 255 MB. In short, 100% of the swap memory is available immediately after reboot. (2) I think we all agree that after using the device, the swap memory begins to be consumed, so after a bunch of multitasking, use of heavy apps, etc., the swap memory will drop to something like 200MB out of 255MB total. After more use, it may drop to 130 MB out of 255MB total. And ultimately can reach 0MB out of 255MB total. (3) On my device, shutting down the heavy apps, multitasking windows, etc. does NOT restore the swap capacity, so the available swap memory tends only to go down. (4) I have noticed that slowdown both within apps like Fenix and while switching between the three homescreens, and in general other usage, is noticeable and irritating. The slowdown I experience is directly proportional to the degree that swap memory is utilized. Performance slows early on, though it is hardly noticeable, but then gets progressively worse until it absolutely cripples the device. (5) MY QUESTION. Yes, we all know that rebooting the device will get us back to a snappy 255MB out of 255MB of swap available. BUT, how can this exact result be obtained without rebooting the device??? Something like a swap memory refresh script is what I'm looking for. Can you dig it? :) |
Re: How to free swap memory without rebooting?
Don't have any other answer to your query except what all other said i.e. No. Till now haven't heard of any such possible solution or script but that doesn't mean its impossible. That being said you can definitely increase your swap memory without making any changes to your main memory and it is well explained here
http://talk.maemo.org/showpost.php?p...02&postcount=4 which means It will free the 256MB of RAM reserved as Swap and instead use new mtd partition and create new swap memory of 420+MB Currently 1GB RAM is used as 768 MB RAM and 256MB as Swap later it will be used as 1GB RAM + 420MB of SWAP (additional) which means more RAM and more SWAP for your mobile :) Steps are given on this post http://talk.maemo.org/showpost.php?p...3&postcount=51 If you find any issue just PM me. I can explain in detail ;) Cheers |
Re: How to free swap memory without rebooting?
Quote:
Quote:
Quote:
If what you say is this indeed the case then I would expect the available RAM to go drastically down as well. Yes, it is theoretically possible that the swap apace is completely full while the RAM is not. I would expect that to happen if a memory hungry background task has not been used for a long time. Let's call it task X. Other tasks have started, allocated some memory, the kernel had to resort to pushing some memory blocks already in RAM to swap. If task X has not used its memory for a while (and forgot to free it), then after a while it might find all its memory swapped out. When other tasks terminate, they release their memory but task X's memory is not moved from swap back to RAM as it is not needed (yet). This is however a very hypothetical situation that is very easily verified. To give us a better picture, could you please post the result of: Code:
free Code:
top (After starting top, press 'm' to sort the processes by memory usage.) |
In the interest of science, here you are:
BusyBox v1.20.0.git (MeeGo 3:1.20-0.2+0m8) built-in shell (ash) Enter 'help' for a list of built-in commands. ~ $ free total used free shared buffers Mem: 1008648 967212 41436 0 27132 -/+ buffers: 940080 68568 Swap: 262136 54776 207360 ~ $ And here is the top output: Mem: 967620K used, 41028K free, 0K shrd, 27724K buff, 248328K cached Thanks for your interest. Just to make sure, though, I'm really looking for an answer to paragraph (5) in the post above, which should be the same for all N9s, without regard for any specific memory data. :) |
Re: How to free swap memory without rebooting?
Your 'free' output looks OK. Swap is barely used. I assume you are not experiencing any problems now, are you?
A more interesting of the 'top' output would be the following few lines, like this: Code:
Mem: 229072K used, 6180K free, 0K shrd, 43144K buff, 46060K cached |
Quote:
Thanks! I like a good mystery/investigation . . . |
Re: How to free swap memory without rebooting?
Quote:
The kernel may well decide to use swap during boot, but this is not likely. Quote:
Quote:
Imagine (just hypothetically) a music player tells pulseaudio to allocate a chunk of 4MB to buffer music (this is clearly false, but only a made-up example) and then exists without telling pulseaudio that it doesn't need the buffer anymore. The memory used by the player is freed, but those 4MB are still there, allocated (reserved) and basically orphaned forever. Quote:
Quote:
You could try reducing the swappiness, but this will just make your N9 use more RAM. You could also try reducing the block/inode cache. This will get you more free memory at the expense of everything being slower. Basically, the only way to not leak memory is by using programs that don't leak memory. Given the unfortunately "common wisdom" that you are supposed to reboot every couple of hours/days, most programmers don't feel the need to do things properly, thus reinforcing that common wisdom. |
Reinob, I greatly appreciate your response and am thankful for all of the information and help you and others have contributed to this thread.
I think that the middleware idea is the likely issue, with the occasional misbehaving program also being another possible complication. I suppose that reboot is not the worst thing in the world, and if that's the only way to get things fully cleared, then I'll live. :) I still find it strange that things are this way, but c'est la vie avec N9. |
Re: How to free swap memory without rebooting?
But Hacker, please continue investigating this :)
I would like to see what are the programs that are hogging memory on your device, so after few days when it starts swapping a lot, use "top" to see who is the culprit. I assume then just killing&restarting that program you will get your memory back... |
Re: How to free swap memory without rebooting?
Quote:
If so, I've read somewhere (maybe not even applicable anymore) that anonymous memory (backed by swap, not by file, e.g. malloc()'d memory) cannot be reclaimed unless it can be moved to swap (?). Meaning if your swap is too small to even hold a copy of the RAM, then you may actually have memory blocks which *could* be freed which are not been free'd because of lack of swap (???). Besides, it may be that many programs overcommit memory. When a program "reserves" a chunk of memory, that memory is reserved from swap. The memory is only really allocated when it's used. Meaning, if you have little swap (and the N9 has too little), there may be programs which cannot reserve memory (even if it's available), only because of lack of sufficient swap. The only advice I can give is: 1. Increase your swap (if partitioning is a problem with the N9, just make a swap file). 2. Decrease your swappiness (e.g. echo 20 > /proc/sys/vm/swappiness). 3. Increase VFS cache pressure (e.g. echo 200 > /proc/sys/vm/vfs_cache_pressure). This way cache is reclaimed when necessary (instead of swapping out programs). Other things that could help would be e.g. reducing M_MMAP_THRESHOLD and/or M_TRIM_THRESHOLD (at least for long-running programs). But I don't know what the default values are on the N9 (nor on the N900 for that matter). |
Re: How to free swap memory without rebooting?
Quote:
Perhaps it was about a distinction between pageable and non-pageable memory. The latter means memory that is not allowed to be moved to swap because the kernel needs it permanently in RAM (file system cache is an obvious example). That is not the same as cannot be moved to swap because of a lack of swap space. But I would still find it strange. |
Edit: Removed, something wrong with TMO app, brings me to wrong thread respective to the title
|
All times are GMT. The time now is 14:25. |
vBulletin® Version 3.8.8