syncthing / syncthing-android

Wrapper of syncthing for Android.
https://syncthing.net/
Mozilla Public License 2.0
3.57k stars 403 forks source link

GUI setting for GOGC to reduce memory usage #596

Closed djtm closed 7 years ago

djtm commented 8 years ago

4) There are GOGC and GOMAXPROCS flags which you can use to limit RAM & CPU usage Could you maybe add a configuration option to set those flags? https://github.com/syncthing/syncthing-android/issues/379

I agree. As GOGC could help with memory usage. But currently there is no way to set the environment variable in the UI. It would be great if you might be able to implement that. I guess 25% might be a better default, too, for Android.

wweich commented 8 years ago

AFAIK, a lower GOGC means less RAM but more CPU. So 25% might be a good value only for devices with little RAM.

Nutomic commented 8 years ago

How much RAM is Syncthing using on your device? (according to the info in the drawer). If you have lots of data, the index will use more RAM (and don't think that will be affected by this setting).

djtm commented 8 years ago

I think the total index was decoupled from RAM at some point during 0.11.x. And I think the working index is reduced by GC. It's not using very much memory, but I have only 512 MB on the device and it's acting as a media center (kodi) as well. As kodi uses a lot, there is not much left for syncthing, so sometimes it's OOM killed.

Nutomic commented 8 years ago

I guess it can't hurt to have that feature. And it's really trivial to implement, too.

Let me know if you want to code it yourself, because I don't know when I'll get around to it.

djtm commented 8 years ago

I guess it would take place somewhere in https://github.com/syncthing/syncthing-android/blob/master/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java, mimicking sttrace. However, I don't have an Android build environment (actually never had one), have no experience in Java or Android programming. So I'll rather wait on this one. Thanks!

gerroon commented 8 years ago

Could lowering memory use improve the crash issues some get on Android?

djtm commented 8 years ago

If they are out of memory crashes then yes, probably.

Nutomic commented 7 years ago

788 is implemented for the next release, so you can set any environment variables you want.