We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 437267e commit c21334eCopy full SHA for c21334e
examples/plot_fmri_data_example.py
@@ -67,8 +67,12 @@
67
"ignore", message="The provided image has no sform in its header."
68
)
69
70
-# Limit the ressoruce use for the example to 5 G.
71
-resource.setrlimit(resource.RLIMIT_AS, (int(5 * 1e9), int(5 * 1e9)))
+# Limit the ressoruce use for the example to 5 G or maximum of possible.
+limit_5G = int(5 * 1e9)
72
+soft, hard = resource.getrlimit(resource.RLIMIT_AS)
73
+new_soft_limit = limit_5G if soft < 0 else min(limit_5G, soft)
74
+new_hard_limit = limit_5G if hard < 0 else min(limit_5G, hard)
75
+resource.setrlimit(resource.RLIMIT_AS, (new_soft_limit, new_hard_limit))
76
n_job = 1
77
78
0 commit comments