Commit 74cceb61 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Fixed bug on Mac OSX caused by too many open files. Fixes #1946.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@5672 41f8697f-d340-4b68-9986-7bafba869bb8
parent 942c8281
Loading
Loading
Loading
Loading
+12 −1
Changes for isis/src/control/apps/pointreg/pointreg.cpp: 12 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

#include "Isis.h"

#include <sys/resource.h>

#include "AutoReg.h"
#include "AutoRegFactory.h"
#include "Camera.h"
@@ -252,8 +254,17 @@ void IsisMain() {
  progress.SetMaximumSteps(outNet.GetNumPoints());
  progress.CheckStatus();

  //  Get the maximum allowable number of open files
  struct rlimit limit;
  if (getrlimit(RLIMIT_NOFILE, &limit) != 0) {
    QString msg = "Cannot read the maximum allowable open files from system resources.";
    throw IException(IException::Programmer, msg, _FILEINFO_);
  }
  //  Allow for library files, etc
  unsigned int maxOpenFiles = limit.rlim_cur * .60;

  cubeMgr = new CubeManager;
  cubeMgr->SetNumOpenCubes(500);
  cubeMgr->SetNumOpenCubes(maxOpenFiles);

  QString validate = ui.GetString("VALIDATE");
  if (validate != "SKIP") {
+4 −0
Changes for isis/src/control/apps/pointreg/pointreg.xml: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -226,6 +226,10 @@
      registrations whose measurements differ in resolution greater than the
      specified tolerance.
    </change>
    <change name="Tracie Sucharski" date="2014-01-02">
      Fixed bug which caused pointreg to crash on Mac OSX platforms because of too
      many open files.  Fixes #1946.
    </change>
  </history>

  <groups>