Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41814

Re: io.BytesIO

From Fabian von Romberg <fromberg100@hotmail.com>
Subject Re: io.BytesIO
Date 2013-03-25 00:10 -0500
References <mailman.3688.1364183789.2939.python-list@python.org> <514fd6d3$0$29998$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.3689.1364188221.2939.python-list@python.org> (permalink)

Show all headers | View raw


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?
> 
> 

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

io.BytesIO Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-24 22:56 -0500
  Re: io.BytesIO Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-25 04:47 +0000
    Re: io.BytesIO Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-25 00:10 -0500
      Re: io.BytesIO Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-25 06:54 +0000
        Re: io.BytesIO Fabian von Romberg <fromberg100@hotmail.com> - 2013-03-25 21:43 -0500

csiph-web