"Benjamin Lukner" <Benjamin.Lukner_at_trinomix.de@mp3mounter.de> wrote in
message news:%23X2YjvQbFHA.1044@TK2MSFTNGP10.phx.gbl...[color=blue]
>
> Under CE the memory runs full because the garbage collection doesn't clean
> up. So I added:
>
> GC.Collect()
> GC.GetTotalMemory(True)
> GC.WaitForPendingFinalizers()
>
> This runs perfectly under CE. But under XP it seems to dispose objects
> that are created afterwards, _while_ they are created!
>
>[/color]
Calling GC.Collect() is usually discouraged except under a few extreme
circumstances. You may want to recompile your app for the desktop so you
can run the CLR Allocation Profiler and watch what your objects are doing.
A gc will happen under memory pressure, but you want to make sure your
objects are actually collectible. Be careful of finalizers and global
objects - those are things that prolong . You may want to consider
explicitly setting objects to null (VB:Nothing) as soon as you are done with
them. Also consider if you actually need all those object instances.
Depending on what you are doing, you might be able to re-engineer certain
things into static (VB:Shared) methods.
There is an MSDN article that discusses using CLR Profiler here:
http://msdn.microsoft.com/msdnmag/is...n/default.aspx
--
David McNamee
Mobility Architect
developerLabs, Inc
http://www.developerLabs.NET/