|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CLR behavior about accessing data during garbage collection workingI got a curiosity while using CLR.
How can it be done that accessing object data by CLR application is safe even while garbage collector is working? Is the GC thread running in realtime priority for this for example? Please reply. Thanks in advance. Hyun-jik Bae The CLR pauses all threads while garbage collecting. Thats why it is a
performance hit to call it yourself and to keep invoking it with short term memory allocations. Ciaran O'Donnell Show quote "Hyun-jik Bae" wrote: > I got a curiosity while using CLR. > How can it be done that accessing object data by CLR application is safe > even while garbage collector is working? Is the GC thread running in > realtime priority for this for example? > Please reply. Thanks in advance. > > Hyun-jik Bae > > > > Hello Hyun-jik Bae,
Just to add Ciaran's post: GC pause nothing, it just ask CLR to suspend/resume threads. It's not just simple suspension, there are some cases how threads are suspended based on whether threads are in managed code or not H> I got a curiosity while using CLR. H> How can it be done that accessing object data by CLR application is H> safe H> even while garbage collector is working? Is the GC thread running in H> realtime priority for this for example? H> Please reply. Thanks in advance. H> Hyun-jik Bae H> --- WBR, Michael Nemtsev :: blog: http://spaces.live.com/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche I always thought that the GC will not collect managed resources when they
are in use and that's exactly what he is saying no? Unmanaged resources that's a different story that's why we have GC.KeepAlive() Gabriel Lozano-Morán Show quote "Michael Nemtsev" <nemt***@msn.com> wrote in message news:1799a79b3bd2168c8d324cfb930c7@msnews.microsoft.com... > Hello Hyun-jik Bae, > > Just to add Ciaran's post: > GC pause nothing, it just ask CLR to suspend/resume threads. It's not just > simple suspension, there are some cases how threads are suspended based on > whether threads are in managed code or not > > H> I got a curiosity while using CLR. > H> How can it be done that accessing object data by CLR application is > H> safe > H> even while garbage collector is working? Is the GC thread running in > H> realtime priority for this for example? > H> Please reply. Thanks in advance. > H> Hyun-jik Bae > H> --- > WBR, > Michael Nemtsev :: blog: http://spaces.live.com/laflour > > "At times one remains faithful to a cause only because its opponents do > not cease to be insipid." (c) Friedrich Nietzsche > > "Hyun-jik Bae" <imays_NOSPAM@hitel.net> wrote in message It isn't.... the gc moves everything. That's why the GC suspends all news:ev54sbOBHHA.4592@TK2MSFTNGP03.phx.gbl... >I got a curiosity while using CLR. > How can it be done that accessing object data by CLR application is safe > even while garbage collector is working? Is the GC thread running in threads in managed code before it starts running. Show quote > realtime priority for this for example? > Please reply. Thanks in advance. > > Hyun-jik Bae > > > Hello Ben,
A small addition - GC calls functions to do the suspension and the resumption as a service provided in the CLR. It's the work of CLR and EE(Execution Engine) to manage this BV> "Hyun-jik Bae" <imays_NOSPAM@hitel.net> wrote in message BV> It isn't.... the gc moves everything. That's why the GC suspendsBV> news:ev54sbOBHHA.4592@TK2MSFTNGP03.phx.gbl... BV> >> I got a curiosity while using CLR. >> How can it be done that accessing object data by CLR application is >> safe >> even while garbage collector is working? Is the GC thread running in BV> all threads in managed code before it starts running. BV> >> realtime priority for this for example? Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour>> Please reply. Thanks in advance. >> Hyun-jik Bae >> --- WBR, "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche |
|||||||||||||||||||||||