Skip to content

Commit 38b0d6c

Browse files
committed
Minor cleanup
1 parent 237a58a commit 38b0d6c

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

linux_rlimit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# -*- coding: utf-8 -*-
22

33
#
4+
# Creative Commons Attribution Share Alike 4.0 International License
45
# Roland Pihlakas, 2018, roland@simplify.ee
56
#
67

78

8-
# Set memory limits for current process, to specified 'size' in bytes
9+
# Set memory limits for current process, to specified 'size' in bytes
910
def set_mem_limits(data_size, address_space_size):
1011

1112

@@ -20,7 +21,7 @@ def set_mem_limits(data_size, address_space_size):
2021

2122
# (resource.RLIMIT_STACK, (int(8 * 1024 * 1024), int(8 * 1024 * 1024))),
2223
# (resource.RLIMIT_MEMLOCK, (int(64 * 1024), int(64 * 1024))), # The maximum address space which may be locked in memory. # 64kB is the default soft and hard limit
23-
# (resource.RLIMIT_MSGQUEUE, (0, 0)), # The number of bytes that can be allocated for POSIX message queues.)
24+
# (resource.RLIMIT_MSGQUEUE, (0, 0)), # The number of bytes that can be allocated for POSIX message queues.
2425
# (resource.RLIMIT_SIGPENDING, (0, 0)),
2526
# (resource.RLIMIT_NICE, (10, 10)), # -20 is the highest priority and 19 is the lowest priority
2627
# (resource.RLIMIT_SBSIZE, (0, 0)), # The maximum size (in bytes) of socket buffer usage for this user. This limits the amount of network memory, and hence the amount of mbufs, that this user may hold at any time. # Availability: FreeBSD 9 or later.

windows_jobobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
#
4+
# Creative Commons Attribution Share Alike 4.0 International License
45
# Roland Pihlakas, 2017, roland@simplify.ee
56
# Aya, 2013, https://stackoverflow.com/users/172176/aya
67
#
@@ -118,7 +119,6 @@ def set_mem_commit_limit_worker(pid, size, min_free_swap = None):
118119

119120

120121
# child processes inherit the job object so it is not necessary to check for the parent
121-
main_pid = os.getpid() # if __name__ == '__main__' else os.getppid()
122122

123123

124124
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms682409(v=vs.85).aspx
@@ -162,7 +162,7 @@ def set_mem_commit_limit_worker(pid, size, min_free_swap = None):
162162
success_assign = ctypes.windll.kernel32.AssignProcessToJobObject(job, process)
163163
# assert success
164164

165-
#if __name__ != '__main__': # NB! due to JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag
165+
# NB! comment-out: due to JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag do not close the job handle here
166166
# success = ctypes.windll.kernel32.CloseHandle(job)
167167
# # assert success
168168

0 commit comments

Comments
 (0)