io.BytesIO
Fabian von Romberg
fromberg100 at hotmail.com
Mon Mar 25 01:10:04 EDT 2013
Hi Steven,
actually why I need is to know how much memory has been allocated for buffering.
getsizeof gets the size of the object structure.
For example, if I do io.BytesIO.truncate(10000), it will resize the buffer to 10000 bytes. So my question is how to get those 10000 back from an attribute or method?
Regards,
Fabian
On 03/24/2013 11:47 PM, Steven D'Aprano wrote:
> On Sun, 24 Mar 2013 22:56:12 -0500, Fabian von Romberg wrote:
>
>> Hi,
>>
>> is there any way to get the allocated memory size from a io.BytesIO
>> object?
>
> The same as for any object:
>
> py> import io, sys
> py> obj = io.BytesIO()
> py> sys.getsizeof(obj)
> 48
>
>
> Is this what you are after, the size of the object itself, including any
> overhead?
>
>
More information about the Python-list
mailing list