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

Issue 2414: Add gc header size to returned sizeof information

Can't Edit
Can't Publish+Mail
Start Review
Created:
1 year, 5 months ago by schuppenies
Modified:
4 months, 1 week ago
Reviewers:
MrJean1, Martin v. Löwis
CC:
SVN Base:
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 Patch
Doc/library/sys.rst View 1 2 1 chunk 29 lines 1 comment Download
Lib/test/test_sys.py View 1 2 4 chunks 60 lines 0 comments Download
Modules/_testcapimodule.c View 2 1 chunk 12 lines 0 comments Download
Python/sysmodule.c View 1 2 3 chunks 109 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 ...
1 year, 5 months ago
Martin v. Löwis
1 year, 5 months ago
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 r497