# RubyTorrent memory usage

**URL:** <https://www.ruby-forum.com/t/rubytorrent-memory-usage/59869>\
**Category:** Ruby\
**Created:** [May 8, 2006, 12:19am UTC](https://www.ruby-forum.com/t/rubytorrent-memory-usage/59869 "2006-05-08T00:19:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackedder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@blackedder](https://www.ruby-forum.com/u/blackedder)\
**Post date:** [May 8, 2006, 12:19am UTC](https://www.ruby-forum.com/t/rubytorrent-memory-usage/59869/1 "2006-05-08T00:19:42Z")

</div>

Hi all,

I’ve been using the rubytorrent library to build a webbased torrent  
client, but when I start a torrent ruby wll slowly start using more and  
more memory and in about three hours it will use 100% (512mb) of memory.  
The package seems unmaintained (no activity the last year and no reply  
to email) so basically two questions:

1. Does anyone here use rubytorrent. Do they have the same problems or  
is it just me.

2. How would I debug this. I looked into the creation of objects by the  
library (by monitoring objectspace) and it mostly creates Arrays and  
Procs (Arrays go from 40000 at the start to 400000 after half an hour),  
but the number of objects based on the rubytorrent classes stays about  
the same. Is there a way to find out by which object another object is  
created; for example have an object report it has been created by  
RubyTorrent::Peer.

Edwin

P.S. this is on ruby 1.8.4 in linux.

---

<div class="post-metadata">

**Author:** ![blackedder](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@blackedder](https://www.ruby-forum.com/u/blackedder)\
**Post date:** [May 8, 2006, 12:44am UTC](https://www.ruby-forum.com/t/rubytorrent-memory-usage/59869/2 "2006-05-08T00:44:20Z")

</div>

On May 7, 2006, at 6:19 PM, Edwin van Leeuwen wrote:

> 1. Does anyone here use rubytorrent. Do they have the same problems or  
> RubyTorrent::Peer.
> 
> Edwin
> 
> P.S. this is on ruby 1.8.4 in linux.
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

It’s probably the Procs that are causing the “leak”. Blocks grab  
their _entire_ environment so that code like  
proc { eval(…) }  
doesn’t break

The “problem” is that as long as it is possible to reference that  
proc, it is possible to reference everything in that proc’s enclosing  
scope.
