[Mono-dev] Garbage Collection Issue?
Matt Dargavel
matt at shout-telecoms.com
Fri May 14 06:07:16 EDT 2010
Thanks for all the replies.
I did try HeapBuddy and HeapShot but had some problems using both, although I was probably using the tip revisions. I'll give them another go.
> "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?"
I don't think it's the same situation. I've been running some soak tests and eventually the process gets killed when the system runs short of memory (and there's quite a lot of memory available!).
> 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.
I've tried setting some of the more obvious variables to null to try and help the Garbage Collector, but unfortunately it's made no difference. I'll double check for disposable objects though.
Thanks again,
Matt.
> -----Original Message-----
> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] On Behalf Of Stifu
> Sent: 14 May 2010 9:21 AM
> To: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Garbage Collection Issue?
>
>
> 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.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list