Re: About speed



"Bryce K. Nielsen" <bryce@xxxxxxxxxxx> a écrit dans le message de news:
449d9bff$1@xxxxxxxxxxxxxxxxxxxxxxxxx

| Memory. Even with GC you still need to behave responsibly with your
memory.
| I use "using()" all the time (which "frees" it in Delphi-way-of-thinking,
| Dispose() for you DotNetters) but even then I see strange behaviors from
| time to time.

No, Dispose() doesn't free memory, it only releases resources on instances
of classes that support IDisposable.

You cannot free objects explicitly, you can only set the last reference to
nil and then let the GC clear it up when it is ready. Forcing GC is
inefficient and not advised.

Using "using" will not free objects, it will only call Dispose() if the
object supports IDisposable, which is only needed to release resources.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


.



Relevant Pages

  • Re: Bitmap constructor throwing System.Exception
    ... > calling Dispose() repeatedly may actually cause more problems if the users ... the virtual nature of memory on the PPC ... > possibility that long lived objects may be eating up available resources. ... >> problem is caused by the lack of managed memory. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Bitmap constructor throwing System.Exception
    ... If your hope is to prevent the absorption of resources... ... calling Dispose() repeatedly may actually cause more problems if the users ... the virtual nature of memory on the PPC ... >> does not force the garbage collector to spin through unused objects at ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: What does GC.GetTotalMemory really tell us?
    ... > Disposing boy was to free up memory resources, ... Dispose doesn't really say anything about GC - it isn't usually used ... Console.WriteLine("Memory with hog:\t", howMuchDuring); ...
    (microsoft.public.dotnet.framework)
  • Re: Disposing managed resources
    ... can, if it needs, to get more resources. ... using the Dispose() method of that interface. ... understand the .NET memory model very well, nor does he really seem to ... Almost all System.Drawing hold unmanaged resources ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: memory leak
    ... Adding GC.Collectcauses the memory to drop, ... Now do you still agree that the GC will cleanup Bitmap objects? ... Dispose is not a required call - it is optional. ... done with those resources. ...
    (microsoft.public.dotnet.framework.compactframework)