[issue2898] Add memory footprint query

2008-10-13 Thread Jesús Cea Avión
Changes by Jesús Cea Avión <[EMAIL PROTECTED]>: ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue2898] Add memory footprint query

2008-06-18 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: Jean Brouwers wrote: > 1) In the first line of function dict_sizeof() > + res = sizeof(PyDictObject) + sizeof(mp->ma_table); > is the sizeof(mp->ma_table) counted twice? Yes, you are right. I'll fix this. > 2) Since functions lis

[issue2898] Add memory footprint query

2008-06-18 Thread Jean Brouwers
Jean Brouwers <[EMAIL PROTECTED]> added the comment: Three questions on the sizeof.patch: 1) In the first line of function dict_sizeof() + res = sizeof(PyDictObject) + sizeof(mp->ma_table); is the sizeof(mp->ma_table) counted twice? 2) Since functions list_sizeof and dict_sizeof re

[issue2898] Add memory footprint query

2008-06-01 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: Applied in r63856. -- status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue2898] Add memory footprint query

2008-05-31 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: The patch looks fine to me, please apply. Don't forget to add a Misc/NEWS entry. -- assignee: gvanrossum -> schuppenies resolution: -> accepted ___ Python tracker <[EMAIL PROTECTED]>

[issue2898] Add memory footprint query

2008-05-29 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: Nick Coghlan helped me to clear my 'metaclass confusion' so here is a patch without an additional __sizeof__ for type objects. Added file: http://bugs.python.org/file10465/sizeof.patch ___ Python track

[issue2898] Add memory footprint query

2008-05-29 Thread Robert Schuppenies
Changes by Robert Schuppenies <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file10463/sizeof.patch ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue2898] Add memory footprint query

2008-05-29 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: The attached patch implements the sizeof functionality as a sys module function. __sizeof__ is implemented by object as a instance method, by type as a class method as well as by types which's size cannot be computed from basicsize, itemsi

[issue2898] Add memory footprint query

2008-05-28 Thread Jesús Cea Avión
Changes by Jesús Cea Avión <[EMAIL PROTECTED]>: -- nosy: +jcea ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list mailing l

[issue2898] Add memory footprint query

2008-05-28 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: thanks, that did the trick. ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-

[issue2898] Add memory footprint query

2008-05-28 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: You probably just need to make the method a class method -- see METH_CLASS. ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue2898] Add memory footprint query

2008-05-28 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: I tried to implement a magic method __sizeof__() for the type object which should be callable for type objects and type itself. But calling __sizeof__ results in an error message >>> type.__sizeof__() Traceback (most recent call last):

[issue2898] Add memory footprint query

2008-05-20 Thread Facundo Batista
Changes by Facundo Batista <[EMAIL PROTECTED]>: -- nosy: +facundobatista __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Uns

[issue2898] Add memory footprint query

2008-05-19 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > I'm torn about the extra slot; I'd rather not add one, but I can't see > how to make this flexible enough without one. I think adding a default __sizeof__ implementation into object (__basicsize__ + len()*__itemsize__), plus overriding tha

[issue2898] Add memory footprint query

2008-05-19 Thread Guido van Rossum
Guido van Rossum <[EMAIL PROTECTED]> added the comment: I'm torn about the extra slot; I'd rather not add one, but I can't see how to make this flexible enough without one. It should definitely not be a built-in; the sys module is fine though (e.g. sys.getrefcount() lives there too). __

[issue2898] Add memory footprint query

2008-05-17 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Guido, recently you've been opposed to adding more slots. Any opinions on this one? Also, is this something you want an additional builtin for? -- assignee: -> gvanrossum nosy: +gvanrossum __ T

[issue2898] Add memory footprint query

2008-05-17 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > Lists will need a custom tp_footprint then, too. True. > BTW, is a new slot necessary, or > can it just be a type method called __sizeof__? It wouldn't be a type method, but a regular method on the specific type, right? I think that wou

[issue2898] Add memory footprint query

2008-05-17 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: Lists will need a custom tp_footprint then, too. Or, if we call it sizeof, the slot should be tp_sizeof. BTW, is a new slot necessary, or can it just be a type method called __sizeof__? __ Tracker <[EMAIL PROTECT

[issue2898] Add memory footprint query

2008-05-17 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > Proposals like this have been rejected in the past. Memory consumption > is an evasive concept. Lists over-allocate space That issue is addressed in this patch. > there are freelists, but they allocate just an upper bound. > there a

[issue2898] Add memory footprint query

2008-05-17 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Proposals like this have been rejected in the past. Memory consumption is an evasive concept. Lists over-allocate space, there are freelists, there are immortal objects, the python memory allocator may hang-on to space thought to be av

[issue2898] Add memory footprint query

2008-05-17 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: It's actually not possible, in general, to compute the memory consumption of an object using basicsize and itemsize. An example is the dictionary, where there is no way to find out how many slots are currently allocated. Even for the things

[issue2898] Add memory footprint query

2008-05-17 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: Such implementation-specific things usually went into the sys module. __ Tracker <[EMAIL PROTECTED]> __ _

[issue2898] Add memory footprint query

2008-05-17 Thread Robert Schuppenies
Robert Schuppenies <[EMAIL PROTECTED]> added the comment: > Can't you write this as a simple Python function using > type.__basicsize__ and type.__itemsize__? Yes, it would be possible and has been done, e.g. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/546530. The problem is though,

[issue2898] Add memory footprint query

2008-05-17 Thread Georg Brandl
Georg Brandl <[EMAIL PROTECTED]> added the comment: Can't you write this as a simple Python function using type.__basicsize__ and type.__itemsize__? In any case, if this is added somewhere it should not be a builtin. This operation is nowhere near the usefulness to be one. -- nosy: +geo

[issue2898] Add memory footprint query

2008-05-17 Thread Robert Schuppenies
New submission from Robert Schuppenies <[EMAIL PROTECTED]>: I propose a patch which allows to query the memory footprint of an object. Calling 'footprint(o)', a python developer can retrieve the size of any python object. Only the size of the object itself will be returned, the size of any refere