This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Find out size of primitive object (PR#214)
Type: enhancement Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: later
Dependencies: Superseder:
Assigned To: jhylton Nosy List: jhylton, lemburg, nobody
Priority: normal Keywords:

Created on 2000-08-01 21:13 by anonymous, last changed 2022-04-10 16:02 by admin. This issue is now closed.

Messages (5)
msg759 - (view) Author: Nobody/Anonymous (nobody) Date: 2000-08-01 21:13
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
msg760 - (view) Author: Nobody/Anonymous (nobody) Date: 2000-08-01 21:14
Interesting idea.
Is this what we need?
msg761 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2000-09-07 22:01
Please do triage on this bug.
msg762 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2000-09-08 12:14
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).
msg763 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2000-09-15 18:56
entere in pep 42
History
Date User Action Args
2022-04-10 16:02:13adminsetgithub: 32836
2000-08-01 21:13:51anonymouscreate