Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion python/src/pyarrow/adapters/pandas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ class ArrowDeserializer {
PyAcquireGIL lock;

// Zero-Copy. We can pass the data pointer directly to NumPy.
Py_INCREF(py_ref_);
OwnedRef py_ref(py_ref_);
Copy link
Member

@wesm wesm Nov 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised by this -- PyArray_SetBaseObject claims to steal a reference (https://docs.scipy.org/doc/numpy-dev/reference/c-api.array.html#c.PyArray_SetBaseObject), so if we are not incrementing the memory owner's reference count, then it could get garbage collected while the NumPy array is still alive. I believe you that it's leaking memory. To really be sure about this, we may wish to expose the ConvertArrayToPandas method in pyarrow.Array.to_pandas and then examine the reference counts before and after the conversion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to dig into this a little myself out of curiosity

npy_intp dims[1] = {col_->length()};
out_ = reinterpret_cast<PyArrayObject*>(PyArray_SimpleNewFromData(1, dims,
Expand Down