1

I'm trying to run a Python file, but every time it gives me this error. What could be the cause of this error and a possible solution? I'm using the latest version of numpy-1.17.0

numpy.core._exceptions.MemoryError: Unable to allocate array with shape 
(129941, 400, 16) and data type int32
1
  • Kindly provide the traceback and the code snippet that errors out. Commented Aug 11, 2019 at 9:26

2 Answers 2

1

I think your array is too big. int32 is 32 bits so 4 bytes and 4*129941*400*16 = 3326489600 bytes = 3.3264896 Gigabytes.

Sign up to request clarification or add additional context in comments.

3 Comments

what can be the possible solution?
use a smaller array @JaydeepBorkar
I freed up some space by killing unnecessary processes and it worked. Thanks for the help :)
0

This is likely due to your system's overcommit handling mode.
In the default mode, 0,
You can check it using

$ cat /proc/sys/vm/overcommit_memory

You have to set it 1,using

$ echo 1 | sudo tee /proc/sys/vm/overcommit_memory

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.