IgnorantGuru / spacefm

SpaceFM File Manager
http://ignorantguru.github.com/spacefm/
GNU General Public License v3.0
489 stars 73 forks source link

Excessive Memory Use After Copying Files To Android Phone #230

Closed arclance closed 11 years ago

arclance commented 11 years ago

After copying several large audio files (flac) to my android phone overnight I found that spacefm was using 600MiB of memory, much higher than its usual 50-200 MiB of used memory. The copy did take several hours (the phone writes really slow), I don't know if that could have anything to do with it. I was using the v0.8.3 built for gtk2.

IgnorantGuru commented 11 years ago

One thing about memory use to note is that in some cases the OS will not return memory which an app frees. So if spacefm requires 50MB and then frees it, the OS may still show it using the maximum it hit. I'm no expert on this but it's probably related to efficiency.

So the 600MB in this case may represent a maximum that was hit for some reason. That does seem unusually high, but it could represent some momentary backup in gtk or a theme, for example, perhaps related to the copy thread blocking. Just speculating - can't really say based on the info here thus far. You might quantify "really slow" for the record.

I can insert a blocking delay and try a long-running copy task to see if there is a small leak being multiplied over periods of time.

arclance commented 11 years ago

It stayed at 600MiB for several hours before I noticed that the system memory use was higher than normal. I would say it was like that for at least 4-6 hours before I noticed it. I did leave it for an hour because I was busy with something else and the memory used stayed the same for that whole time.

I also have a cronjob setup to clear caches and other things from memory every 6 hours to prevent the system cache from growing into my swap since that slows everything down when it happens.

You might quantify "really slow" for the record.

That would be 10-100 KiB/s with the phone in usb mass storage mode and the phones sdcard mounted with the "sync" option, the copy took ~4-6 hours (I don't know exactly I slept through most of it). If you don't set sync no data is written to the sdcard until you run "sync" in a terminal or script. That sync takes just as long as the copy would when mounted with "sync". I believe that the sdcard is formated in vfat but I have not checked it recently to be sure.

I am going to stick to copying things to the phone over SFTP from now on since I can copy at ~1 MiB/s that way.

IgnorantGuru commented 11 years ago

Keeping an eye on SpaceFM's memory usage, I have seen it get into the neighborhood of 600MB a few times with multiple panels and windows being used. As noted above, this high number may 'stick' in the memory management even if the actual use later drops, if nothing else requests the memory. So I'm not sure this indicates any dysfunction particularly related to copying.

arclance commented 11 years ago

I see that as well. You might want to look into it, it has gotten worse lately. I have not opened a bug report about it because I have no cause to point to. I can run it though a memory profiler like valgrind on my system if you want to see if there are any problems it might reveal.

In this case it jumped a large amount after the copy and nothing else was done. I have not seen it happen again though but I don't copy to my phone that way anymore because it is so slow.

IgnorantGuru commented 11 years ago

Please add any additional to #346