I applied the group rule for a specific user, and I would like to check if the memory of programs running from the specified user is limited, as expected. I tried with the following script:
import string import random if __name__ == '__main__': d = {} i = 0; for i in range(0, 100000000): val = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(200)) # generate ramdom string of size 200 d[i] = val if i % 10000 == 0: print i
When I tracked the process using the ps command, it turned out that% MEM was increased to 4.8 and never changed when the cgroups service was turned on and off:
$ ps aux | grep mem_intensive.py USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND jason 11531 88.5 4.8 3312972 3191236 pts/0 R+ 22:16 0:07 python mem_intensive.py
In this case, the total memory is 62 GB, while 4.8% is about 3 GB. I set a limit of 4 GB without any other processes running on this user.
So can anyone give me some idea about this problematic python script? Thanks in advance.
source share