0fe5722744318069da8c0a3b7e2cd7bac3954ef3,python/ray/memory_monitor.py,MemoryMonitor,raise_if_low_memory,#MemoryMonitor#,105

Before Change



            self.last_checked = time.time()
            total_gb = psutil.virtual_memory().total / (1024**3)
            used_gb = total_gb - psutil.virtual_memory().available / (1024**3)
            if self.cgroup_memory_limit_gb < total_gb:
                total_gb = self.cgroup_memory_limit_gb
                with open("/sys/fs/cgroup/memory/memory.usage_in_bytes",

After Change


                return  // escape hatch, not intended for user use

            self.last_checked = time.time()
            psutil_mem = psutil.virtual_memory()
            total_gb = psutil_mem.total / (1024**3)
            used_gb = total_gb - psutil_mem.available / (1024**3)

            // Linux, BSD has cached memory, which should
            // also be considered as unused memory
            if hasattr(psutil_mem, "cached"):
                used_gb -= psutil_mem.cached / (1024**3)

            if self.cgroup_memory_limit_gb < total_gb:
                total_gb = self.cgroup_memory_limit_gb
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: ray-project/ray
Commit Name: 0fe5722744318069da8c0a3b7e2cd7bac3954ef3
Time: 2020-08-13
Author: wlx65005@gmail.com
File Name: python/ray/memory_monitor.py
Class Name: MemoryMonitor
Method Name: raise_if_low_memory


Project Name: ray-project/ray
Commit Name: 0fe5722744318069da8c0a3b7e2cd7bac3954ef3
Time: 2020-08-13
Author: wlx65005@gmail.com
File Name: python/ray/memory_monitor.py
Class Name: MemoryMonitor
Method Name: raise_if_low_memory


Project Name: ray-project/ray
Commit Name: 71d2bde458e4ea760ed29dc21c6046b3fd02d616
Time: 2020-08-11
Author: wlx65005@gmail.com
File Name: python/ray/memory_monitor.py
Class Name: MemoryMonitor
Method Name: raise_if_low_memory


Project Name: home-assistant/home-assistant
Commit Name: 778c3bb83da49189596e1a920819bf52aca38805
Time: 2017-10-17
Author: cgtobi@users.noreply.github.com
File Name: homeassistant/components/sensor/systemmonitor.py
Class Name: SystemMonitorSensor
Method Name: update