• 11
name

I'm trying to temporarily (without restarting the machine, just for test that starts a JVM) increase the number of processes to 2048 in OSX Yosemite but I'm unable to do so.

First, I tried calling ulimit -S -u 2048 but that returns:

ulimit: value exceeds hard limit

The hard limit is 1064:

$ ulimit -Hu
1064

I've used sysctl to change the limit of kern.maxproc and kern.maxprocperuid and that worked fine:

$ sudo sysctl -w kern.maxprocperuid=2048
$ sudo sysctl -w kern.maxproc=2048
$ sysctl kern.maxprocperuid kern.maxproc
kern.maxprocperuid: 2048
kern.maxproc: 2048

I have also tried to change the limits of launchctl maxproc and that seemed to work fine:

$ sudo launchctl limit maxproc 2048 2048
$ launchctl limit maxproc
maxproc     2048           2048

However, in spite of changing all this, I'm still unable to change the upper limit of ulimit -u.

The reason I'm doing all of this is cos I'm having some OOME: Unable to create native thread errors in a JVM that's started from a MVN test, even though I've passed to it -Xss265k -Xmx2g.

Any ideas?

Even though you only want to change the limit temporarily, the change must be done in a persistent way by creating /Library/LaunchDaemons/limit.maxproc.plist file, owned by root:wheel and permissions 644 with these contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
    <dict>
      <key>Label</key>
        <string>limit.maxproc</string>
      <key>ProgramArguments</key>
        <array>
          <string>launchctl</string>
          <string>limit</string>
          <string>maxproc</string>
          <string>2048</string>
          <string>2048</string>
        </array>
      <key>RunAtLoad</key>
        <true />
      <key>ServiceIPC</key>
        <false />
    </dict>
  </plist>

Thanks to Jason Greene for the help with this!

  • 1
Reply Report
      • 1
    • Thanks for sharing this. I'm curious, what do we risk by raising this further? I've had issues in the past with maxproc and had to raise it quite a bit; haven't had the issue for a few years now, but after maxing out my Mac Pro at 128 GB RAM, I'm seeing issues again and looks like I'm going to have to take it up to at least 2048... but I'm curious what really do we risk by taking it even further aside from just running out of resources?

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions