> Then, on Ubuntu 14.04, 32-bit:
> $ python mega_concat.py
> Segmentation fault (core dumped)
What is your Python version? It looks like Ubuntu Trusty provides Python 2.7.6. I'm unable to reproduce the issue on ArchLinux 32-bit with Python 2.7.8. The issue was maybe fixed between 2.7.6 and 2.7.8.
[haypo@arch32 ~]$ cat megaconcat.py
N = 2**17
my_array = []
for i in range(N):
my_array.append("\"\"")
print('+'.join(my_array))
[haypo@arch32 ~]$ python2 -V
Python 2.7.8
[haypo@arch32 ~]$ ulimit -v 8000
[haypo@arch32 ~]$ python2 megaconcat.py
Traceback (most recent call last):
File "megaconcat.py", line 5, in <module>
my_array.append("\"\"")
MemoryError |