views:

359

answers:

1

Hello!

I have created a Ruby XMPP Framework called babylon. I have then created a few applications with it and even though they run pretty smoothly, it seems that they're eating my computer memory bit by bit.

I suspected leaks, so first, I added this at some point in my code :

puts `ps -o rss= -p #{Process.pid}`.to_i

As suspected, the output kept increasing... slowly, but surely.

I tried to hunt the leaks with Dike, like explained here.

Unfortunetely, Dike was not able to detect any leak. Even after it ran for a quite long time, it still returns the same objects.

So, how can I be sure that my framework is leaking, and not just taking some RAM until some maximum point and then starting to release it?

And then, how can I actually track the leaks and fix them?

Thanks for your help!

+1  A: 

I've heard good things about the Ruby Memory Tracking API but it is not free.

There is also a useful blog post for using valgrind to find ruby memory leaks.

There are other solutions for Ruby on Rails but it doesn't seem like you are using rails at all.

Kyle Boon
Valgrind was the solution for me... but I had to install Linux...
Julien Genestoux
@Julein Genestoux, You got two solutions for the price of one.
Wayne Conrad