Error of Memory in Python

Asked

Viewed 330 times

1

I’m tempted to days solve this problem and can’t, my scripts works on various python machines, but on the server I need to run the application and presents the error, I’ve left a memory test running for three days and the memories are perfect.

str_grande = ''.join((str(y) for y in list(sys.stdin.readline())))
x = [int(e) for e in str_grande.split()]

------------------------------------------------------

Traceback (most recent call last):
File "welton.py", line 12, in 
str_grande = ''.join((str(y) for y in list(sys.stdin.readline())))
MemoryError
Command exited with non-zero status (1)

If I run the program in C, it works perfectly! But since I need Python integration for subfunctions I cannot use C. In this language I use the "long long int" is there any similar Python structure? NOTE: list and dictionaries have size limit! In list does not accept +12,000 elements

Equipment is:! 1.4GHz Quad-Core ARM Cortex-A5 2.4GHz wireless network and 5GHz IEEE 802.11.b / g / n / ac, Bluetooth 4.2, BLE Gigabit Ethernet via USB 2.0 (maximum throughput of 300mbps) 1 GB of RAM 64-bit CPU 4 USB ports 4-pole stereo output and composite video port Full size HDMI 10/100 Baset Ethernet socket Micro SD port to load your Ubuntu operating system and store data

  • wouldn’t it be better to process the data line by line so as not to burst the memory? Type: for line in sys.stdin: print(int(line))

  • And what your code should do?

  • It should take a volume of Numbers from 1 to 99999, process some rules, and then give the result. The numbers are random and can be sequences of 3 or even sequences of 99999!

  • It should take an absurd amount of data to process until it reaches a certain point, and resume data capture now just by totaling!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.