[Mono-dev] Garbage Collection Issue?
Stifu
stifu at free.fr
Fri May 14 04:21:09 EDT 2010
This happened to me too, but I found the cause. It was a disposable object
that I replaced with another one without disposing of it first.
In my case, I found out doing the following gave the best results as far as
memory is concerned:
myobj.Dispose();
myobj = null;
myobj = newobj;
Without setting the object to null, memory is fred later.
After that, Mono and .NET both used as much memory.
Personally, every time I've had memory leaks, it was due to objects that
implement IDisposable that weren't disposed. So far, I didn't really need to
use a profiler, as I could find out exactly when memory wasn't released by
simply using my application and watching memory usage.
Maciej Paszta wrote:
>
> On Thu, May 13, 2010 at 7:07 PM, Matt Dargavel
> <matt at shout-telecoms.com>wrote:
>
>> Hi there,
>>
>>
>>
>> We have an application written in Mono that appears to be
>> leaking memory. I’ve tried using the profiler and mprof-heap-viewer to
>> identify any objects that are being left around, but I couldn’t see
>> anything
>> significant. The application doesn’t seem to leak on .NET, so I was
>> starting to wonder about the Boehm GC. Will using the heap snapshots
>> show
>> any objects that are no longer being referenced, but have not been
>> Garbage
>> Collected? Also, is there a way to enable the heap profiler but only for
>> heap snapshots using the telnet interface- i.e. without the allocations
>> info
>> as these generate huge amounts of data in a soak test. Finally, does
>> anyone
>> have any other suggestions on where else I should look / other
>> diagnostics
>> to try?
>>
>>
>>
> I have experienced similar behavior. When app was running under .NET the
> memory was freed, but switching to Mono caused memory to climb up. I did
> some investigation but I couldn't find anything wrong with the code - I
> had
> tried all profilers available for mono. The I gave my app a little time
> and
> memory was eventually freed but after a longer period of time - maybe it's
> the same situation?
>
>
> --
> Maciej Paszta
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
--
View this message in context: http://mono.1490590.n4.nabble.com/Garbage-Collection-Issue-tp2197862p2216258.html
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list