Last active
August 29, 2015 14:25
-
-
Save bergerx/b85f6063070ea619cd83 to your computer and use it in GitHub Desktop.
python memory error test
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
ubuntu@ubuntu1:~$ mkdir python-memory | |
ubuntu@ubuntu1:~$ cd python-memory/ | |
ubuntu@ubuntu1:~/python-memory$ bash | |
ubuntu@ubuntu1:~$ sudo mkdir /sys/fs/cgroup/memory/hede | |
ubuntu@ubuntu1:~/python-memory$ cat /sys/fs/cgroup/memory/hede/memory.limit_in_bytes | |
18446744073709551615 | |
ubuntu@ubuntu1:~/python-memory$ sudo tee /sys/fs/cgroup/memory/hede/memory.limit_in_bytes | |
50000000 | |
50000000 | |
ubuntu@ubuntu1:~/python-memory$ cat /sys/fs/cgroup/memory/hede/memory.limit_in_bytes | |
50003968 | |
ubuntu@ubuntu1:~/python-memory$ /bin/echo $$ | sudo tee -a /sys/fs/cgroup/memory/hede/cgroup.procs | |
32122 | |
ubuntu@ubuntu1:~/python-memory$ | |
ubuntu@ubuntu1:~/python-memory$ cat /sys/fs/cgroup/memory/hede/cgroup.procs | |
32122 | |
32360 | |
ubuntu@ubuntu1:~/python-memory$ cat /proc/$$/cgroup | |
12:name=systemd:/user/1000.user/14.session | |
11:hugetlb:/user/1000.user/14.session | |
10:net_prio:/user/1000.user/14.session | |
9:perf_event:/user/1000.user/14.session | |
8:blkio:/user/1000.user/14.session | |
7:net_cls:/user/1000.user/14.session | |
6:freezer:/user/1000.user/14.session | |
5:devices:/user/1000.user/14.session | |
4:memory:/hede | |
3:cpuacct:/user/1000.user/14.session | |
2:cpu:/user/1000.user/14.session | |
1:cpuset:/ | |
ubuntu@ubuntu1:~/python-memory$ cat > hede.py | |
def main(): | |
a=[] | |
for i in range(10000000000): | |
a[i+1]=i+1 | |
if __name__ == '__main__': | |
main() | |
ubuntu@ubuntu1:~/python-memory$ python hede.py | |
Traceback (most recent call last): | |
File "hede.py", line 7, in <module> | |
main() | |
File "hede.py", line 3, in main | |
for i in range(10000000000): | |
MemoryError | |
ubuntu@ubuntu1:~/python-memory$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment