Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Traversing the object space.

Reply
Thread Tools

Traversing the object space.

 
 
Lothar Scholz
Guest
Posts: n/a
 
      09-01-2003
Ruby has a nice function that can traverse the complete object space
of your program.

Is there anything like this in python ? It seems to be not in the
standart library but maybe i can find a short script somewhere else.

It is a nice way for to do some memory checks to find out if a part of
your app is generating too much objects.
 
Reply With Quote
 
 
 
 
Jp Calderone
Guest
Posts: n/a
 
      09-01-2003
On Mon, Sep 01, 2003 at 11:31:45AM -0700, Lothar Scholz wrote:
> Ruby has a nice function that can traverse the complete object space
> of your program.
>
> Is there anything like this in python ? It seems to be not in the
> standart library but maybe i can find a short script somewhere else.
>
> It is a nice way for to do some memory checks to find out if a part of
> your app is generating too much objects.



import gc
print gc.get_objects()

Jp

> --
> http://mail.python.org/mailman/listinfo/python-list


--
"Pascal is Pascal is Pascal is dog meat."
-- M. Devine and P. Larson, Computer Science 340

 
Reply With Quote
 
 
 
 
Mark Hahn
Guest
Posts: n/a
 
      09-01-2003
> > Ruby has a nice function that can traverse the complete object space
> > of your program.
> >
> > Is there anything like this in python ? It seems to be not in the
> > standart library but maybe i can find a short script somewhere else.
> >
> > It is a nice way for to do some memory checks to find out if a part of
> > your app is generating too much objects.

>
>
> import gc
> print gc.get_objects()
>


Does this only report objects that support the garbage collector?


 
Reply With Quote
 
Michael Hudson
Guest
Posts: n/a
 
      09-02-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Lothar Scholz) writes:

> Ruby has a nice function that can traverse the complete object space
> of your program.
>
> Is there anything like this in python ?


In a debug build, there's sys.getobjects(). In recent release builds,
there's gc.get_objects() which I think only returns containers, but a
bit of creativity can find all objects from there (note that, unless
you try really hard instances of any classes you define will count as
containers).

Cheers,
mwh

--
ARTHUR: Why should he want to know where his towel is?
FORD: Everybody should know where his towel is.
ARTHUR: I think your head's come undone.
-- The Hitch-Hikers Guide to the Galaxy, Episode 7
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
traversing a client directory in ASP.NET =?Utf-8?B?c2xpbV9uYWxkeQ==?= ASP .Net 10 05-12-2005 02:10 AM
Traversing properties with a datagrid nmosafi@gmail.com ASP .Net 4 01-04-2005 04:08 PM
XML - traversing in VB Asad ASP .Net 1 04-16-2004 02:20 AM
Traversing Access types in Modelsim steven VHDL 6 08-27-2003 01:04 PM



Advertisments