Skip to content

Commit b84f851

Browse files
committed
Skip setting memory limit on 64-bit systems to prevent crash.
1 parent 88448eb commit b84f851

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

myDevices/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from os import path, getpid, remove
33
from myDevices.cloud.client import CloudServerClient
44
from myDevices.utils.logger import exception, setDebug, info, debug, error, logToFile, setInfo
5-
from sys import excepthook, __excepthook__, argv
5+
from sys import excepthook, __excepthook__, argv, maxsize
66
from threading import Thread
77
from signal import signal, SIGUSR1, SIGINT
88
from resource import getrlimit, setrlimit, RLIMIT_AS
@@ -16,9 +16,9 @@ def setMemoryLimit(rsrc, megs = 200):
1616
soft, hard = getrlimit(rsrc)
1717
info ('Limit changed to :'+ str( soft))
1818
try:
19-
#setMemoryLimit(RLIMIT_DATA)
20-
#setMemoryLimit(RLIMIT_STACK)
21-
setMemoryLimit(RLIMIT_AS)
19+
#Only set memory limit on 32-bit systems
20+
if maxsize <= 2**32:
21+
setMemoryLimit(RLIMIT_AS)
2222
except Exception as e:
2323
error('Cannot set limit to memory: ' + str(e))
2424

0 commit comments

Comments
 (0)