Re: Best practice using large objects in foreach



Yes. The C version is the correct way.
I dont't think there would be no halt because the objects remain in gen1.
And on the server side GC is concurrent.
But yes, it's (almost) always imperative to Dispose() as fast as you can.

"Marc Gravell" <marc.gravell@xxxxxxxxx> ha scritto nel messaggio
news:1154013700.784036.269770@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No; C is /vastly/ more efficient overall, as the memory footprint is
minimised during processing due to early disposal. In A & B this is
performed by the GC, so you will see (for a large set) the memory usage
ramp for a while, then processing grind to a halt as the GC tears down
the improperly discarded images, and then the memory start ramping up
again. I would anticipate C to stay fairly constant both in terms of
memory footprint and processing rate, and it will put much less stress
on the rest of the system - important in a server environment.

Marc



.



Relevant Pages

  • Managed DirectPlay Leaking Memory
    ... leaking memory on both the client and the server. ... I do dispose the NetworkPacket... ... They keep growing memory as if the NetworkPacket was not released... ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: Web Application and Memory
    ... What's the size of selecting data? ... For example in case of using DataSet in ASP.net memory consumption of data is increased in 4 times. ... F> increase of memoring using by my application server. ... F> 'dispose of the Dataset/adaptater objects ...
    (microsoft.public.dotnet.framework)
  • Re: Garbage Collection not running?
    ... We have been looking in to memory leaks but the fixes we ... that any object that has a Dispose() method should have that method called ... the server to hang but this server is not hanging. ... This amount of memory lets me think that you have a memory leak ...
    (microsoft.public.dotnet.framework.aspnet)
  • Asp.net application and Memory of the server
    ... I m worried about the memory of my server. ... I can notice a terrifying ... For example, before start application, the memory using is about 280mo. ... liberate all my object as soon as i can by the nothing and dispose codes. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Web Application and Memory
    ... I m worried about the memory of my server. ... I can notice a terrifying ... For example, before start application, the memory using is about 280mo. ... liberate all my object as soon as i can by the nothing and dispose codes. ...
    (microsoft.public.dotnet.framework)