[Numpy-discussion] Overlapping copy with object_ arrays
Travis Oliphant
oliphant at ee.byu.edu
Wed Dec 6 14:27:43 CST 2006
James Flowers wrote:
> Hello,
>
> Having a problem with overlapping copies. Memory being freed twice
> ??? See below:
Thanks for the test. This problem is fixed and will be checked into
SVN as soon as I can figure out why I'm not able to access SVN from my
work machine.
The problem is that object array copies were done by first decrementing
the reference count of all elements of the destination array and then
incrementing the reference count of all elements of the destination
array once the copy was complete.
For over-lapping copies (containing only a single reference to an
object). This created a problem as the reference count went to 0 before
the copy occurred.
I've changed the code so that the reference count of the source is
increased and the reference count of the destination is decreased before
the copy is made. Then, the reference counts are correct after the copy
is completed even for over-lapping copies.
-Travis
More information about the Numpy-discussion
mailing list