[Numpy-discussion] segmentation fault
Hoyt Koepke
hoytak@gmail....
Wed May 28 10:55:57 CDT 2008
In my experience tracking down these sorts of things, if the effect is
delayed and detected by glibc, it almost always means that a few bytes
beyond the end of the data part of an array have been overwritten.
This causes glibc's memory management stuff to crash later on when the
object is deallocated (or something like that). Of course, I should
say I was doing the overwritting in my own c code...
--Hoyt
On Wed, May 28, 2008 at 8:27 AM, Pauli Virtanen <pav@iki.fi> wrote:
> ke, 2008-05-28 kello 10:59 -0400, Scott Ransom kirjoitti:
>> Hmmm. Interesting. I'm on a 64-bit Debian Unstable system with numpy
>> 1.0.4 and python 2.5.2 and I don't get this:
>>
>> In [1]: import numpy as np
>>
>> In [2]: np.__version__
>> Out[2]: '1.0.4'
>>
>> In [3]: def fn():
>> ...: x = np.random.rand(5,2)
>> ...: x.cumsum(None, out=x)
>> ...: return x
>> ...:
>>
>> In [4]: fn()
>> Out[4]:
>> array([[ 0.40329303, 0.45335328],
>> [ 0.85664631, 0.84798294],
>> [ 1.71329262, 0.05877989],
>> [ 2.56127556, 0.99401291],
>> [ 4.27456818, 0.79275409]])
>>
>> Wonder if the 64-bit thing could be the difference?
>
> Try running fn() again to make the bug bomb out:
>
> $ python
> Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> imp
> KeyboardInterrupt
>>>> import numpy as np
>>>> def fn():
> ... x = np.random.rand(5,2)
> ... x.cumsum(None, out=x)
> ... return x
> ...
>>>> np.__version__
> '1.0.5.dev5024'
>>>> fn()
> array([[ 0.59654253, 0.12577169],
> [ 0.72231422, 0.30600244],
> [ 1.44462843, 0.35849553],
> [ 1.75063088, 0.56925858],
> [ 3.19525931, 0.77487798]])
>>>> fn()
> *** glibc detected *** python: munmap_chunk(): invalid pointer:
> 0x08439d28 ***
>
> --
> Pauli Virtanen
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
--
+++++++++++++++++++++++++++++++++++
Hoyt Koepke
UBC Department of Computer Science
http://www.cs.ubc.ca/~hoytak/
hoytak@gmail.com
+++++++++++++++++++++++++++++++++++
More information about the Numpy-discussion
mailing list