Memory profiling

Discussion in 'Python' started by Rune Froysa, Sep 24, 2003.

  1. Rune Froysa

    Rune Froysa Guest

    I have a fairly large program that uses a number of third-party
    modules. After a few hours the program eats several 100M of memory.

    Does Python provide any tools that can help in determining where the
    memory is used? Ideally, I would like to see a tool that can list all
    objects by memory-usage, but any tool that can return the number of
    bytes used by an arbitrary object would be of great help. Even
    something that could find all allocated dicts&lists and return their
    size+name would help.

    Regards,
    --
    Rune Fr√łysa
    University of Oslo, Norway
    Rune Froysa, Sep 24, 2003
    #1
    1. Advertising

  2. Rune Froysa <> writes:

    > Does Python provide any tools that can help in determining where the
    > memory is used?


    *Memory*, no. Especially in a debug build, there are tools for
    finding out where the objects are, though.

    > Ideally, I would like to see a tool that can list all objects by
    > memory-usage, but any tool that can return the number of bytes used
    > by an arbitrary object would be of great help. Even something that
    > could find all allocated dicts&lists and return their size+name
    > would help.


    In a debug build, look at sys.getobjects. In a recent release build,
    look at gc.get_objects.

    Cheers,
    mwh

    --
    <arigo> something happens, what I'm not exactly sure.
    -- PyPy debugging fun
    Michael Hudson, Sep 25, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dayjah
    Replies:
    3
    Views:
    12,712
  2. Eddie

    profiling memory usage

    Eddie, Oct 6, 2006, in forum: Python
    Replies:
    3
    Views:
    346
    NOSHII
    Oct 6, 2006
  3. Ram  Prasad

    OT: Memory profiling on Linux

    Ram Prasad, May 1, 2007, in forum: C Programming
    Replies:
    5
    Views:
    393
    Giorgos Keramidas
    May 2, 2007
  4. Replies:
    9
    Views:
    322
    EventHelix.com
    May 20, 2007
  5. minimalism
    Replies:
    0
    Views:
    333
    minimalism
    Dec 28, 2007
Loading...

Share This Page