Last active
October 22, 2019 06:58
-
-
Save sudocurse/a6f3b8f4fb1f55b1dfd2ec44fb80410a to your computer and use it in GitHub Desktop.
macos default fd ulimit is 256. why do i see 252?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tempfile | |
files = [] | |
while True: | |
try: | |
file = tempfile.TemporaryFile() | |
print("Created file:", file, file.name) | |
files.append(file) | |
except OSError: | |
print("Total: {}".format(len(files))) | |
break | |
for x in files: | |
x.close() | |
lolololol real dingus hours right here, these look and act like enums. here's how i should be doing it:
print("Max for process:", resource.getrlimit(resource.RLIMIT_NOFILE))
print("Max for process:", resource.getrlimit(resource.RLIMIT_OFILE))
Max for process: (256, 9223372036854775807)
Traceback (most recent call last):
File "fd.py", line 16, in <module>
AttributeError: module 'resource' has no attribute 'RLIMIT_OFILE'
I wonder what 2^64-1. that tuple output is (soft, hard) limits.9223372036854775807
is
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oh but when i try it in python 3, it starts at 3:
It gets one additional file in the count somehow
(this is 3.6) python 3 still gives me