We are running an python application which needs ~2400MB (on Windows). Our Raspberry Pi 3 has a 4GB swap and runs on 164MB RAM idle. So from our point of view python should be able to use 4GB on the 32Bit system. However when RAM + Swap reaches around 2GB python runs into an MemoryError. Is there a way to show the memory limit of the used python version and is it possible to increase the limit temporary?
-
which type of python are you using on windows? (32 bit or 64 bit?) applications usually have to be compiled with an extra flag to gain support to use more than 2GB of RAM, and assuming you have installed python from a repo (guessing raspbian) it most likely has not been compiled with that flag as there is only 1GB to start with, assuming i'm correct you would have to download and compile python yourself to be able to use more RAM (even if it's swap rather than physical RAM)– James KentCommented Mar 20, 2017 at 14:05
-
the reason i ask which type on windows is because 64 bit is compiled with that flag, 32 bit is not.– James KentCommented Mar 20, 2017 at 14:06
-
I use the 32bit version on windows and used this guide: gisgeek.blogspot.de/2012/01/… to use more than 2GB. There you change a flag in the header of the executable without recompiling, that's why I asked if it is possible to increase the limit.– Daniel MüssigCommented Mar 20, 2017 at 14:08
1 Answer
Your kernel could be build with 2G/2G memory split (giving 2GB of virtual address space to the kernel and leaving another 2GB for the applications). You can check that in kernel config:
zcat /proc/config.gz | grep CONFIG_VMSPLIT
If this is the case, no application will be allowed to allocate more than 2GB, no matter how much RAM and swap you have. You'll have to compile a kernel with CONFIG_VMSPLIT_2G=n
(or find a kernel someone else compiled with that flag switched off) to use more than 2GB.
LARGEADDRESSAWARE
is specific to PE executable format and doesn't exist in Linux where ELF executables are used.