I have 8 gb of ram, ssd and very greedy for ram Android studio/gradle. and sometimes when gradle builds project(eats ram) it hangs all ubuntu(and xubuntu). ui becomes so laggish - mouse cursor moves 1 cm per 10 seconds.

i dont know why it happens and it seems that no one knows cause there is a couple questions like mine in internet about "studio freezes ubuntu", "heavy for ram application freezes ubuntu", "ubuntu hangs when full ram", etc. and symptoms are the same. and there is also tracked bug since 2007. it seems that it's very specific situation because in one moment gradle needs a lot of ram for operating with big files on disk. it seems like at the same time it needs both ram and storage for opperating with big files. and somehow it hangs the system.

so my question is - is there any option to disable buff/cache? or maybe param like swappines (0..100) but for buff/cache? i know that i shouldn't care for ram used for cache because it is available at any time, but i think in this case it doesn't work as should. maybe i am drastically wrong)

  • There is no option to disable buff/cache for the system as a whole. It may be possible to disable cache for a specific program by running it using nocache. I am voting to close this question as unclear, because it does not give any details about the buff/cache that you think is a problem. I.e. are you just guessing, or did you have "buff/cache" numbers that led you to believe this. If so, the numbers should be described more specifically in the question (and what command you used to show them). – sourcejedi Jun 29 '19 at 17:51
  • It would be better to include links to the questions you think are related. The linked bug is marked as "incomplete", meaning the developer did not find the report clear enough to do anything about. The report does not talk about use of buff/cache, so there's no specific reason to think their matlab case was related to your theory about your problem with android studio. "heavy for ram application freezes ubuntu" on its own just sounds like running out of ram (bad effects are expected, sorry), and not something where you would benefit from disabling cache. – sourcejedi Jun 29 '19 at 18:24
  • If you have a specific build-up of "cache" and you need to assure yourself that it would be immediately reclaimed when necessary (or not), there is a "drop_caches" technique. E.g. see "Clearing the disk cache" at linuxatemyram.com/play.html Some memory shown as "cache" in the free/top commands will not be affected by drop_caches, the main reasons are here: unix.stackexchange.com/questions/322168/… – sourcejedi Jun 29 '19 at 18:36

i found out that i had only 2gb file swap and my 8gb swap partition wasn't enabled(it's lame. but i'm new in linux). file partition swap was full on high loading and i assume that an ubuntu freeze was just a lack of virtual memory. i am still not sure about that because i remember that there was still 400-700mb buff/cache available memory before freeze. but anyway i mark this question as solved due to enabling 8gb swap partition. will reopen if freeze occur.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.