1

Currently my script runs an algorithm that require allocation of many objects, as a result I receive a "Memory Error".

However, from monitoring my memory usage, the error occurs when I'm only using 4Gb out of 16Gb of my total memory capabilities on my computer. Is there a way to increase the allowed memory consumption for my python script up to 16Gb?

I have tried to use https://docs.python.org/2/library/resource.html#resource.setrlimit and set everything to MAX_VALUE, yet I still have the error at 4Gb of memory consumption.

Any pointers will be helpful.

I have read: Set Python memory limit and many posts like it but they don't directly address my problem.

Here is a what "ulimit -a" outputs, if it is of any use.

evan@evan-box:~$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 96626
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 96626
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

thanks.

Community
  • 1
  • 1
Evan Pu
  • 2,099
  • 5
  • 21
  • 36

1 Answers1

1

Are you running a 64bit kernel check the following

file /sbin/init

uname -m
Denilson Sá Maia
  • 47,466
  • 33
  • 109
  • 111
wwright
  • 364
  • 2
  • 8
  • evan@evan-box:~$ file /sbin/init /sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x07075fcb55b05aeb6286efabba63534fa6ecd213, stripped evan@evan-box:~$ uname -m i686 – Evan Pu Aug 05 '14 at 18:33
  • so actually with a 32bit kernel I can't even use all of my memory?! *gasp* – Evan Pu Aug 05 '14 at 18:33
  • `2**32` bytes is 4 GiB. 32-bit executables can't address more than 4 GiB of RAM. Please make sure your system (both kernel and the python interpreter) are 64-bit. – Denilson Sá Maia Aug 05 '14 at 18:55
  • if you are using a VM you could just create another VM and use a 64b install – wwright Aug 05 '14 at 18:57