[SciPy-user] array resize() method error in scipy_core

Chris Fonnesbeck fonnesbeck at gmail.com
Fri Dec 9 23:33:10 CST 2005


On 12/10/05, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>
> The resize function is very conservative about letting you resize the
> memory of an array in-place because of the possibility of sharing the
> data through the buffer interface.  If you resized the memory while
> another object was holding the memory you could easily get a segfault
> later.
>
> Unfortunately, there is no way to tell whether another object is
> referencing the memory of the array except through the reference count
> (which also increases on simple name binding, too.)
>
> So, perhaps while profiling an additional reference is being held to the
> objects and therefore, the resize function won't let you resize the
> memory.   I'm not sure how to be more generous about when resizing is
> possible.
>

Hi Travis,

I assume you mean the resize *method*, right? Should I go back to
using the function (i.e. resize(my_array) rather than
my_array.resize())? I switched over because it seemed faster, not
having to use oldnumeric and all ...

--
Chris Fonnesbeck
Atlanta, GA



More information about the SciPy-user mailing list