How to monitor memory consumed by a method ?

Discussion in 'Ruby' started by Paganoni, Mar 26, 2009.

  1. Paganoni

    Paganoni Guest

    Hello, I've written a library that handle csv conversion...
    Files are big, themselves related and the conversion rules needs several
    hashes.
    Those data will grow up month after month, so I would like to know how
    many memory this import method can consume.

    The only idea I had is launching the linux utility pmap before and after
    the method.

    Is there any other solution ?

    Thanks
     
    Paganoni, Mar 26, 2009
    #1
    1. Advertising

  2. Paganoni

    Peter Zotov Guest

    Quoting Paganoni <>:

    > Hello, I've written a library that handle csv conversion...
    > Files are big, themselves related and the conversion rules needs
    > several hashes.
    > Those data will grow up month after month, so I would like to know
    > how many memory this import method can consume.
    >
    > The only idea I had is launching the linux utility pmap before and
    > after the method.
    >
    > Is there any other solution ?


    Try doing GC.disable before calling method and then ps aux, for
    example. I think this is simplier.

    WBR, Peter Zotov
     
    Peter Zotov, Mar 26, 2009
    #2
    1. Advertising

  3. 2009/3/26 Peter Zotov <>:
    > Quoting Paganoni <>:
    >
    >> Hello, I've written a library that handle csv conversion...
    >> Files are big, themselves related and the conversion rules needs several
    >> hashes.
    >> Those data will grow up month after month, so I would like to know how
    >> many memory this import method can consume.
    >>
    >> The only idea I had is launching the linux utility pmap before and after
    >> the method.
    >>
    >> Is there any other solution ?

    >
    > Try doing GC.disable before calling method and then ps aux, for example. I
    > think this is simplier.


    That way you will see how much memory the process uses up but not, how
    much of that must be attributed to the code in the method in question.
    Note that Ruby may allocate memory from the OS in larger chunks in
    order to prevent too frequent malloc calls and fragmentation. I am
    not sure how helpful that is for the OP's problem.

    Cheers

    robert

    --
    remember.guy do |as, often| as.you_can - without end
     
    Robert Klemme, Mar 27, 2009
    #3
    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. Sanjay
    Replies:
    4
    Views:
    626
    Sanjay
    Nov 20, 2003
  2. Replies:
    5
    Views:
    348
    Raymond
    Aug 20, 2006
  3. www
    Replies:
    0
    Views:
    312
  4. www
    Replies:
    1
    Views:
    432
  5. ScottZ
    Replies:
    2
    Views:
    378
    Jorgen Grahn
    Nov 2, 2008
Loading...

Share This Page