Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108895

Re: How to memory dump an object?

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to memory dump an object?
Date 2016-05-21 15:01 +1000
Message-ID <mailman.71.1463806893.27390.python-list@python.org> (permalink)
References <6c556e26-1350-4fdc-ae9f-7ef198a3ad6b@googlegroups.com> <CAPTjJmrjiXneriVNRZ-Ldp74YQJ4dmu_rKAMYz_ZQ0WzVuOo3Q@mail.gmail.com> <mailman.66.1463797722.27390.python-list@python.org> <b03c12df-b730-410e-84a0-4920c5e98071@googlegroups.com> <CAPTjJmo63agAEdNdZKz546kCvgGPugf8xghYBR5R4Ek+r_4WoQ@mail.gmail.com>

Show all headers | View raw


On Sat, May 21, 2016 at 2:47 PM,  <jfong@ms4.hinet.net> wrote:
> It's amazing the "tool" is so simple. Actually I feel a little embarrassed that I do know every statements in it but just no idea of combining them together. Thanks a lot, Chris.
>

It's a pretty complicated tool, actually - but you're using it in a
simple way here. If you're curious, you can poke around in the CPython
sources to track down the data structures involved - as you noted, the
refcount is at the beginning of every object, and after that you'll
find some neat info like a pointer to its type. You can even change
some of this stuff, but be aware that you can EASILY segfault Python
like this :D

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to memory dump an object? jfong@ms4.hinet.net - 2016-05-20 18:05 -0700
  Re: How to memory dump an object? Ned Batchelder <ned@nedbatchelder.com> - 2016-05-20 18:59 -0700
  Re: How to memory dump an object? Chris Angelico <rosuav@gmail.com> - 2016-05-21 12:28 +1000
    Re: How to memory dump an object? jfong@ms4.hinet.net - 2016-05-20 21:47 -0700
      Re: How to memory dump an object? Chris Angelico <rosuav@gmail.com> - 2016-05-21 15:01 +1000
    Re: How to memory dump an object? wxjmfauth@gmail.com - 2016-05-20 23:55 -0700
  Re: How to memory dump an object? Steven D'Aprano <steve@pearwood.info> - 2016-05-21 14:56 +1000
  Re: How to memory dump an object? jfong@ms4.hinet.net - 2016-05-21 01:08 -0700

csiph-web