BB9z
V2EX  ›  macOS

有没有这样的应用/脚本:自动杀死/重启使用内存超过限额的进程

  •  
  •   BB9z · Jul 19, 2013 · 4147 views
    This topic created in 4716 days ago, the information mentioned may be changed or developed.
    能根据不同应用设置相应限额最好。

    其实内存正常是足够的,但架不住内存泄漏。
    5 replies    1970-01-01 08:00:00 +08:00
    wwwjfy
        1
    wwwjfy  
       Jul 19, 2013   ❤️ 1
    自己写一个,cron定时运行...类似这样

    ps h -eo rss,args | grep <...> | grep -v grep | awk '{if ($2 > 3000) print $1}' | xargs kill

    3000就是多少kb
    wwwjfy
        2
    wwwjfy  
       Jul 19, 2013
    随手写,难免有错,多试试
    swulling
        3
    swulling  
       Jul 19, 2013   ❤️ 1
    man limit
    swulling
        4
    swulling  
       Jul 19, 2013
    额,是ulimit,有人做了个封装,可以看下
    https://github.com/pshved/timeout
    shiny
        5
    shiny  
    PRO
       Jul 19, 2013   ❤️ 1
    我们目前在用 supervisor 的 memmon 插件, 设定超过指定内存后自动重启。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1155 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 23:29 · PVG 07:29 · LAX 16:29 · JFK 19:29
    ♥ Do have faith in what you're doing.