[Python-bugs-list] [Bug #110835] Find out size of primitive object (PR#214)

noreply@sourceforge.net noreply@sourceforge.net
Fri, 15 Sep 2000 11:56:10 -0700


Bug #110835, was updated on 2000-Aug-01 14:13
Here is a current snapshot of the bug.

Project: Python
Category: Core
Status: Closed
Resolution: Later
Bug Group: Feature Request
Priority: 5
Summary: Find out size of primitive object (PR#214)

Details: Jitterbug-Id: 214
Submitted-By: loewis@informatik.hu-berlin.de
Date: Fri, 25 Feb 2000 14:28:33 -0500 (EST)
Version: 1.5.2
OS: Solaris


This is a feature request made on python-help. If you want to estimate
how much memory your application uses, you currently have to count the bytes
manually. If there was a builtin function (say, sys.sizeof), counting would
be much easier. It would be documented as

sizeof(object) -> integer
Return the number of bytes that an object uses internally. This only counts
the number of bytes used by the object itself, not those of any of its 
attributes.

Ie. sys.sizeof(0) would give 12 on my system, the size of a dictionary would
count the dictentries, but the size of an instanceobject would not count the
the size of the __dict__ attribute.



====================================================================
Audit trail:
Tue Mar 07 14:42:18 2000	guido	changed notes
Tue Mar 07 14:42:18 2000	guido	moved from incoming to request

Follow-Ups:

Date: 2000-Aug-01 14:14
By: none

Comment:
Interesting idea.
Is this what we need?
-------------------------------------------------------

Date: 2000-Sep-07 15:01
By: jhylton

Comment:
Please do triage on this bug.
-------------------------------------------------------

Date: 2000-Sep-08 05:14
By: lemburg

Comment:
See mxTools at http://starship.python.net/~lemburg/ for an example of how
to implement a sizeof() function.

The problem with this approach is that it only counts the size of the
object struct itself and doesn't account for any external storage
which may have been allocated by the object (e.g. Unicode objects
and dictionaries use such external resources).
-------------------------------------------------------

Date: 2000-Sep-15 11:56
By: jhylton

Comment:
entere in pep 42

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110835&group_id=5470