Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(290)

Issue 2414: Add gc header size to returned sizeof information

Can't Edit
Can't Publish+Mail
Start Review
Created:
17 years, 11 months ago by schuppenies
Modified:
16 years, 10 months ago
Reviewers:
Martin v. Löwis, MrJean1
Base URL:
http://svn.python.org/view/*checkout*/python/trunk/
Visibility:
Public.

Description

Currently, sys.getsizeof only returns the objects size without taking the GC_HEAD into account. This patch addresses this issue.

Patch Set 1 #

Patch Set 2 : Added PyGC_Head to _testcapi required for testing. #

Patch Set 3 : added a default return value and made this and the gc_head inclusion optional #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -24 lines) Patch
Doc/library/sys.rst View 1 2 1 chunk +11 lines, -2 lines 1 comment Download
Lib/test/test_sys.py View 1 2 4 chunks +28 lines, -0 lines 0 comments Download
Modules/_testcapimodule.c View 2 1 chunk +1 line, -0 lines 0 comments Download
Python/sysmodule.c View 1 2 3 chunks +55 lines, -22 lines 1 comment Download

Messages

Total messages: 2
Martin v. Löwis
http://codereview.appspot.com/2414/diff/24/6 File Doc/library/sys.rst (right): http://codereview.appspot.com/2414/diff/24/6#newcode419 Line 419: func:`getsizeof` calls the object's __sizeof__ method and add's ...
17 years, 11 months ago (2008-06-26 18:05:31 UTC) #1
Martin v. Löwis
17 years, 11 months ago (2008-07-07 05:24:06 UTC) #2
http://codereview.appspot.com/2414/diff/12/14
File Doc/library/sys.rst (right):

http://codereview.appspot.com/2414/diff/12/14#newcode412
Line 412: .. function:: getsizeof(object[, default][, gc_head=True])
I would like to reconsider the addition of the gc_head parameter. I still can't
understand why anybody would like to omit this memory usage from the size of the
object. If there is a real need for such a parameter, it can always be added
later; taking it back if not needed is more difficult.

http://codereview.appspot.com/2414/diff/12/13
File Python/sysmodule.c (right):

http://codereview.appspot.com/2414/diff/12/13#newcode688
Line 688: /* failed. is default value is given? */
"Has a default value been given" or "Was a default value requested"?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b