如何限制Mac OS应用程序可以使用的RAM数量?


7

我安装了保管箱,它具有糟糕的内存管理。它经常使用4GB RAM中的3GB。

有什么方法可以限制应用程序的内存使用量?

我永远不要允许超过250 MB的RAM。


3
您如何确定它正在使用3GB的RAM?
Hasaan Chop'Mar

1
您正在使用哪个版本的Dropbox?
sblair 2010年

内存使用曾经在Mac上易于管理:Cmd-我会给您“信息”窗格,您可以调整其最小和最大分配
warren 2010年

iStat Menus应用程序非常适合监视内存,磁盘,CPU等的使用情况。您还可以使用top命令行实用工具查看活动进程。
哈兰2010年

Answers:


1

您可以尝试使用ulimit内置的Shell来限制资源,尽管然后必须从运行的Shell中启动Dropbox ulimit,而不是从Finder之类的东西中启动。

$ help ulimit
ulimit: ulimit [-SHacdefilmnpqrstuvx] [limit]
    Modify shell resource limits.

    Provides control over the resources available to the shell and processes
    it creates, on systems that allow such control.

    Options:
      -S        use the `soft' resource limit
      -H        use the `hard' resource limit
      -a        all current limits are reported
      -b        the socket buffer size
      -c        the maximum size of core files created
      -d        the maximum size of a process's data segment
      -e        the maximum scheduling priority (`nice')
      -f        the maximum size of files written by the shell and its children
      -i        the maximum number of pending signals
      -l        the maximum size a process may lock into memory
      -m        the maximum resident set size
      -n        the maximum number of open file descriptors
      -p        the pipe buffer size
      -q        the maximum number of bytes in POSIX message queues
      -r        the maximum real-time scheduling priority
      -s        the maximum stack size
      -t        the maximum amount of cpu time in seconds
      -u        the maximum number of user processes
      -v        the size of virtual memory
      -x        the maximum number of file locks

    If LIMIT is given, it is the new value of the specified resource; the
    special LIMIT values `soft', `hard', and `unlimited' stand for the
    current soft limit, the current hard limit, and no limit, respectively.
    Otherwise, the current value of the specified resource is printed.  If
    no option is given, then -f is assumed.

    Values are in 1024-byte increments, except for -t, which is in seconds,
    -p, which is in increments of 512 bytes, and -u, which is an unscaled
    number of processes.

    Exit Status:
    Returns success unless an invalid option is supplied or an error occurs.

您可能想要ulimit -mulimit -v


2
这行不通。我做了ulimit -m 200000ulimit -v 200000然后通过运行了一个应用程序/Applications/ABC.app/Contents/MacOS/ABC。然后,我在杀死进程之前观察到内存的爬升远超过500 MB。
哈兰2010年

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.