Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68439
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'cpython': 0.05; 'debugging': 0.07; 'instances.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:()': 0.09; '(and,': 0.16; '(it': 0.16; 'add,': 0.16; 'from:addr:pitrou.net': 0.16; 'from:addr:solipsis': 0.16; 'from:name:antoine pitrou': 0.16; 'listed,': 0.16; 'message-id:@post.gmane.org': 0.16; 'non- trivial': 0.16; 'object()': 0.16; 'received:213.41.240': 0.16; 'received:213.41.240.54': 0.16; 'received:80.91.229.3': 0.16; 'received:charlus.yi.org': 0.16; 'received:plane.gmane.org': 0.16; 'received:yi.org': 0.16; 'all,': 0.19; '(but': 0.19; 'mechanism': 0.19; 'not,': 0.20; 'hack': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'closely': 0.24; 'primary': 0.26; 'certain': 0.27; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'writes:': 0.31; 'class': 0.32; 'guess': 0.33; 'raw': 0.33; "i'd": 0.34; 'tool': 0.35; 'beyond': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'instances': 0.36; 'useful': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'should': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'expensive': 0.39; 'though,': 0.39; 'use.': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'most': 0.60; 'full': 0.61; 'entire': 0.61; 'strictly': 0.61; 'such': 0.63; 'details,': 0.68; 'subjectcharset:utf-8': 0.72; 'walk': 0.74; 'hand': 0.80; '3.4': 0.84; 'antoine.': 0.84; 'atomic': 0.84; 'situations,': 0.84; 'subject:skip:g 10': 0.84; 'tied': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Antoine Pitrou <solipsis@pitrou.net> |
| Subject | Re: What does gc.get_objects() return? |
| Date | Mon, 17 Mar 2014 17:18:05 +0000 (UTC) |
| References | <lfqcr8$249$1@ger.gmane.org> <5320BD3F.5030509@mrabarnett.plus.com> <lfqjgu$kug$1@ger.gmane.org> <CAPTjJmqdKZ6qDQ+PZAdxVF-hKN=txKh35ga_C451C2z_hpZZAA@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | sea.gmane.org |
| User-Agent | Loom/3.14 (http://gmane.org/) |
| X-Loom-IP | 213.41.240.54 (Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8206.1395076808.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1395076808 news.xs4all.nl 2910 [2001:888:2000:d::a6]:41989 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:68439 |
Show key headers only | View raw
Chris Angelico <rosuav <at> gmail.com> writes: > > It's not strictly an implementation detail, beyond that there are > certain optimizations. For instance... > > > For CPython 3.4 I guess strings and other atomic types such as ints are > > not, as well as raw object() instances. Custom class instances on the other > > hand seem to be under GC control. > > ... strings and ints should never be listed, and custom objects should > always be listed, but I'd say the non-tracking of object() would be an > implementation-specific optimization. These are all implementation details, tied to the fact that the primary object reclaim mechanism in CPython is reference counting. Other implementations may use a full GC and gc.get_objects() may then also return strings and other "atomic" objects (but the implementation may also elicit to hack get_objects() in order to closely mimick CPython). All in all, though, gc.get_objects() is an expensive function call (it will walk the entire graph of objects tracked by the GC, which can be very large in non-trivial applications), so it's really only useful for debugging (and, I'd add, for low-level debugging). In most situations, gc.get_objects() is certainly the wrong tool to use. Regards Antoine.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: What does gc.get_objects() return? Antoine Pitrou <solipsis@pitrou.net> - 2014-03-17 17:18 +0000
csiph-web