Silverlight on Mac - how to debug a memory leak?
I wrote a Silverlight application that acts as a downloader for Amazon S3. It works great on PC, but it has a huge memory leak on Mac.
Problem: I don't know how to debug it. WinDbg, Google's main offering is obviously missing. I don't think I can get a hint from within VS (when connecting using remote debugging). And I haven't tested, but I don't think Mac OS debuggers will be helpful.
The specific behavior is that as the file is loaded, it remains in memory. Since files can be several GB in size, they can use up all memory and cause Silverlight to crash. I suppose this might be a bug in Silverlight, but maybe I can find a workaround if I knew the exact problem. Windows also has a confirmed bug https://connect.microsoft.com/VisualStudio/feedback/details/674960/writing-to-ms-internal-internalwebrequeststream-deadlocks-when-host-closes-request-stream#details which nobody doesn't want to fix it.
This is what I get from using technology that its creator abandoned.
source to share
It turned out that the bug HttpWebRequest.AllowWriteStreamBuffering = false
(or my Windows workaround for it) was causing a horrible memory leak (and other deadlocks) on the Mac. So I was forced to enable buffering. Now everything works, due to pinch progress and reporting of transfer rates.
I wish I had learned the inductive method to find out. I had to find him more or less a chance.
source to share
Have you tried setting up remote debugging on Mac ? It may not track memory leaks, but at least you can walk through the code to see what is going on.
source to share
I would try running a profiler like SciTek.NET Memory Profiler against the Windows version and make sure that you dispose of all your objects correctly and don't actually leak there. Hope this translates the Mac correctly. (Most programmers are very poor at understanding their objects. And yes, it does matter.)
source to share