BB9z
V2EX  ›  macOS

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

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

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

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

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