It has been a while since I worked on heap-buddy, but here is (to the best of my recollection) a summary of the problem.
Mono exposes some generic hooks for profiling, and heap-buddy uses three of those hooks to monitor programs as they run in the VM. In particular, we call into heap-buddy every time mono does an allocation, a GC, or resizes the heap. In each case, we manipulate a data structure that collects statistics about memory usage. In order to be thread safe, the data structure has to be protected by a lock. Further, some of the operations to update that data structure need to call back into mono's C API. The situation with locking in the mono profiling hooks is extremely delicate. I don't pretend to understand all of the issues, but conversations with Ben Mauer led me to believe that it is essentially impossible (at least as of fall of 2005) to do this sort of locking from these distinct profiling hooks. The fact that it works at all on UP machines appears to be a happy accident, and it deadlocks (usually almost immediately) under SMP between the heap-buddy data structure lock and some internal mono lock. The situation sounded dire and my understanding of mono internals is pretty much non-existant, so I didn't spend a lot of time trying to debug the problem: instead, I just disabled hyperthreading in my machine's bios. Since I built heap-buddy to diagnose problems with beagle and not as an end unto itself, that was good enough for me. -J On 4/5/06, Joe Shaw <[EMAIL PROTECTED]> wrote: > Hi, > > Joshua Tauberer wrote: > > For whatever reason, I had trouble using heap buddy a while back when I > > first tried, which led me to trying Nemerle's profiler (and hacking some > > things into it, which was a good experience even if heap buddy already > > did the same things). I was able to find and remove many of the biggest > > object allocators that I found, but I'll give heap buddy a shot again > > for finding objects that aren't being collected. > > One thing I noticed is that heap-buddy will lock up pretty much > instantly on SMP machines. I think Jon filed a bug about that, but I > don't know what it is offhand. Hopefully he can give more info. > > Joe > _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list