Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > How to monitor memory consumed by a method ?

Reply
Thread Tools

How to monitor memory consumed by a method ?

 
 
Paganoni
Guest
Posts: n/a
 
      03-26-2009
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
 
Reply With Quote
 
 
 
 
Peter Zotov
Guest
Posts: n/a
 
      03-26-2009
Quoting Paganoni <(E-Mail Removed)>:

> 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

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      03-27-2009
2009/3/26 Peter Zotov <(E-Mail Removed)>:
> Quoting Paganoni <(E-Mail Removed)>:
>
>> 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

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
finding how much time that is consumed? raybakk@yahoo.no C Programming 5 08-20-2006 07:46 PM
Winupdate consumed most of my free space hregev@yahoo.com Computer Support 2 11-17-2005 01:43 AM
Nachi-A worm consumed all of router's memory? duder Cisco 1 12-12-2003 08:40 PM
Web Service throws 401 Error when consumed Sanjay ASP .Net 4 11-20-2003 04:03 AM



Advertisments