diff --git a/run.py b/run.py index af7d2c6c..082e5c3d 100755 --- a/run.py +++ b/run.py @@ -18,7 +18,7 @@ if project_dir not in sys.path: # stay): the in-process twin of the unit's MALLOC_ARENA_MAX=2, for units # installed before that line. A no-op off glibc. See src/malloc_tuning.py. from src import malloc_tuning -malloc_tuning.cap_arenas() +print('EXP cap_arenas=%s' % malloc_tuning.cap_arenas(), flush=True) # Under systemd the watchdog clock is already running, and start-up (plugin # loads, initial updates) takes far longer than the render loop's limit. Widen diff --git a/src/malloc_tuning.py b/src/malloc_tuning.py index 95d96155..8af5861f 100644 --- a/src/malloc_tuning.py +++ b/src/malloc_tuning.py @@ -117,6 +117,12 @@ class MallocTrimmer: logger.debug("malloc_trim failed; not trying again", exc_info=True) self._libc = None return False - logger.debug("malloc_trim(0) took %.1f ms, released=%s", - (self._clock() - now) * 1000.0, released) + def _rss(): + try: + with open('/proc/self/statm') as f: + return int(f.read().split()[1]) * 4096 // 1024 + except Exception: + return -1 + logger.info("EXP malloc_trim(0) took %.1f ms, released=%s rss_kb_after=%d", + (self._clock() - now) * 1000.0, released, _rss()) return released