Skip to content

Commit

Permalink
Merge pull request #56 from gpilab/develop
Browse files Browse the repository at this point in the history
Improved memory handling
  • Loading branch information
borupdaniel committed Jun 22, 2021
2 parents 1a5ca2a + 3c4fafe commit 5910715
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
23 changes: 21 additions & 2 deletions lib/gpi/GLObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,27 @@
log = manager.getLogger(__name__)

try:
import OpenGL, OpenGL.GL, OpenGL.GLU, OpenGL.GLUT
from OpenGL import GL, GLU
try:
import OpenGL, OpenGL.GL, OpenGL.GLU, OpenGL.GLUT
from OpenGL import GL, GLU

# fallback for OpenGl Module import source
except ImportError:
# https://stackoverflow.com/questions/63475461/unable-to-import-opengl-gl-in-python-on-macos
print('Patching OpenGL import for Big Sur (OSX)')
from ctypes import util
orig_util_find_library = util.find_library

# retrieving the OpenGl Modules from its directory instead of cache
def new_util_find_library (name):
res = orig_util_find_library (name)
if res: return res
return '/System/Library/Frameworks/' + name + '.framework/' + name

util.find_library = new_util_find_library

import OpenGL, OpenGL.GL, OpenGL.GLU, OpenGL.GLUT
from OpenGL import GL, GLU

except ImportError:
log.warn('OpenGL was not found, GL objects and windows will not be supported in this session.')
Expand Down
5 changes: 5 additions & 0 deletions lib/gpi/sysspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ def findAndSetMaxOpenFilesLimit(self):
lim = 10000
hard_lim = 10000

# if the hard limit is infinite (unlimited resources) cap it at 10000
if hard_lim == resource.RLIM_INFINITY:
lim = 10000
hard_lim = 10000

while (not self._inWindows) and (not maxFound):
try:
lim += 10
Expand Down

0 comments on commit 5910715

Please sign in to comment.