[
https://issues.apache.org/jira/browse/ARROW-6926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16977581#comment-16977581
]
Joris Van den Bossche commented on ARROW-6926:
----------------------------------------------
I started with implementing the {{nbytes}} attribute last week (ARROW-3444,
which is merged now), with the idea of afterwards looking at {{sizeof}}.
Main question is if we just want to return what {{nbytes}} does (the number of
bytes in the buffers), which is what the dask approximation does, or if we also
want to include the size of the cython + C++ object.
{{sys.getsizeof}} works out of the box for the cython object (but it ignores
the relevant buffers):
{code}
In [38]: a = pa.array([1, 2])
In [39]: import sys
In [40]: sys.getsizeof(a)
Out[40]: 96
{code}
but when overriding {{\_\_sizeof\_\_}} in Array, I am not sure how to get to
this number so I can add the nbytes of the buffers to it.
> [Python] Support __sizeof__ protocol for Python objects
> -------------------------------------------------------
>
> Key: ARROW-6926
> URL: https://issues.apache.org/jira/browse/ARROW-6926
> Project: Apache Arrow
> Issue Type: Improvement
> Components: Python
> Reporter: Matthew Rocklin
> Priority: Minor
> Fix For: 1.0.0
>
>
> It would be helpful if PyArrow objects implemented the `__sizeof__` protocol
> to give other libraries hints about how much data they have allocated. This
> helps systems like Dask, which have to make judgements about whether or not
> something is cheap to move or taking up a large amount of space.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)