简体   繁体   中英

How python 3.7 allocate heap memory

I'm having issues in K8s with memory allocation. Pod gets killed by OMM Killer, because of strictly defined limits, let's say 1GB.

How python 3.7 (python memory manager) allocates memory? From the pod memory graph I can assume that it allocates double amount of memory for heap.

Linux:

You can limit the used resources from inside your program - not sure if it helps you though:

  • resources.setrlimit

    Sets new limits of consumption of resource. The limits argument must be a tuple (soft, hard) of two integers describing the new limits. A value of RLIM_INFINITY can be used to request a limit that is unlimited.

For windows this might help: Limit python script RAM usage in Windows

Edit: Post for limiting under linux: Limit RAM usage to python program

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM