[Mono-dev] Need help tracking this bug...

Alan McGovern alan.mcgovern at gmail.com
Thu Mar 29 12:12:59 EDT 2007


Basically, i have a major (ish) problem in monotorrent with Mono 1.2.1 and
above. After spending a few hours backtracking through svn revisions, i've
managed to place the origin of the problem to between revision 72227 and
72228 of monotorrent in the mono svn.

To generate the diff just use: svn diff -r 72227:72228
svn://svn.myrealbox.com/source/trunk/bitsharp . I've also attached the diff.

The changes in this diff are solely related to a refactor where i moved
three seperate lists into one main PeerList class. Now, after careful
examination of that diff, i just can't see anything in it that would cause
the problems i'm seeing. Also, to further complicate matters, if i step back
to the mono 1.2 release, everything appears to work perfectly.

Now, the actual bug is that memory usage rockets to 100% after a very short
running time. Typically 30 seconds is plenty of time for the bug to manifest
on a well seeded torrent. I've seen this problem once before on completely
different code (however i can't remember who i was helping track down the
source, but it was a guy on #mono). His code was a crawler for another P2P
network and after a similar amount of time, it would hit 100% memory usage
aswell. I profiled his code using the mono profiler and eventually managed
to get some usable output which pointed out that he was allocating 10000's
of instances of multi-cast delegates which were just eating memory. At the
time, i put this down to bad programming or incorrect usage of async

So, the thing is i can't track down what's causing the memory usage in
monotorrent. I have no idea how to even start. I've tried using the built in
profilers, but they require a graceful exit before they output their data,
and unfortunately i can't get them a graceful exit ;)

If anyone has any ideas on how i could track this problem, or if they need
more information, please let me know. I'm going demented trying to figure
out the problem ;)

Also, for anyone trying to compile revision 72227 from svn, you will need
the "BufferedFileRead.cs" and "BufferedFileWrite.cs" classes which were
commited in rev 72228. I accidently left them out of a previous commit.
Revision 72228 will compile fine (i hope) from a fresh checkout with no

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070329/98fb2ab7/attachment.html 

More information about the Mono-devel-list mailing list