librelist archives

« back to archive

memmory leaks

memmory leaks

From:
Noel
Date:
2012-10-02 @ 13:19
Hi guys.
   I have a memory leak.  I have a sinatra web-service up and running 
that requires my rice wrapped c++ library.  With each http request, the 
memory usage of the application shoots up by a minimum of 60 Mb.
   I am yet to discover where the leak is coming from exactly but out of 
general intuition, here is my suspect list...

1) The c/c++ code I have written to wrap the libraries
2) Rice itself (Or the fact I'm using ruby 1.9.3 with it)
3) Sinatra
4) CGAL
5) Ruby

So, any initial words of wisdom before I embark on this journey of 
discovery?  For example, what happens to constants in my rice code? Do 
they get garbage collected?

Re: [rice] memmory leaks

From:
Paul Brannan
Date:
2012-10-02 @ 13:35
Try running under valgrind to see if the leak is in Rice, in the C++ code,
or in Ruby.  You can use this suppressions file:

https://github.com/cout/ruby-internal/blob/master/ruby.supp

to weed out any of the "normal" memory errors.

If the leak is in Ruby objects, you can use a ruby memory profiler instead
of a C/C++ memory profiler to further narrow down the cause.

Paul

On Tue, Oct 2, 2012 at 9:19 AM, Noel <noelwarr@gmail.com> wrote:

> Hi guys.
>    I have a memory leak.  I have a sinatra web-service up and running
> that requires my rice wrapped c++ library.  With each http request, the
> memory usage of the application shoots up by a minimum of 60 Mb.
>    I am yet to discover where the leak is coming from exactly but out of
> general intuition, here is my suspect list...
>
> 1) The c/c++ code I have written to wrap the libraries
> 2) Rice itself (Or the fact I'm using ruby 1.9.3 with it)
> 3) Sinatra
> 4) CGAL
> 5) Ruby
>
> So, any initial words of wisdom before I embark on this journey of
> discovery?  For example, what happens to constants in my rice code? Do
> they get garbage collected?
>