Re: Can you write code directly in CIL ???
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Tue, 27 Dec 2005 12:50:59 +0100
"Andreas Mueller" <me@xxxxxxxxxxx> wrote in message
news:41cjpeF1cm3s3U1@xxxxxxxxxxxxxxxxx
> Peter Olcott wrote:
>
>> "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote
>> in message news:u3hVLnqCGHA.3064@xxxxxxxxxxxxxxxxxxxxxxx
>>
>>>Peter,
>>>
>>> I highly recommend that you read up on how Garbage Collection works
>>> exactly.
>>
>>
>> I already know this.
>
> No, you obviously don't. The problem is not that the GC will take any
> memory from your method, but that it is running in a separate thread. So
> lets say you method executes in 1/10 s. When garbage collection occurs, it
> will take way longer, simply because your method will halt in the middle
> of something and resume when the GC is done. So from inside your method,
> the execution time was still 1/10, but from the outside the execution time
> is way longer ( A little bit like theory of relativity :-) ).
>
> Relying on the GC to do or not to do something is a capital sin in .NET.
>
>> One thing that it can not do is to reclaim memory that is still in use.
> Correct, it will not try to get you memory, however it will stop you
> thread if it wants to
>> I remember reading the algorithm. It is some sort of aging system. In any
>> case even if my memory needs to be constantly checked to see if it is
>> still in use, I only need a single monolithic large block.
> Yea, and while t checks and sees that it is not allowed to touch you
> monolithic large block, you method will pause and take longer than 1/10s.
>> One thing that I do know about GC, is that it is ONLY invoked when memory
>> runs out, and is needed, otherwise it is never invoked.
> One thing that you must know when developing managed code, is that you
> *never* know when the GC is invoked.
> Watch your performance counters for garbage collection. You'll be
> surprised how busy the area :-)
>
> [snip]
>
> HTH,
> Andy
> --
> To email me directly, please remove the *NO*SPAM* parts below:
> *NO*SPAM*xmen40@*NO*SPAM*gmx.net
Andreas,
The only time the GC runs (un-forced) is when the creation of an object on
the GC heap would overrun the gen0 heap threshold. When this happens the GC
runs on the same thread as the object creator. That means that the GC won't
run as long as you don't create objects instances.
Note that this assumes there is no external memory pressure when there are
extra GC heap segments allocated, this would force the CLR to start a full
collection.
Willy.
.
- Follow-Ups:
- Re: Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- References:
- Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Can you write code directly in CIL ???
- From: Peter Olcott
- Re: Can you write code directly in CIL ???
- From: Andreas Mueller
- Can you write code directly in CIL ???
- Prev by Date: Re: Hashtable items order
- Next by Date: How to generate a dataset from stored procedure which have many resultsets?
- Previous by thread: Re: Can you write code directly in CIL ???
- Next by thread: Re: Can you write code directly in CIL ???
- Index(es):
Relevant Pages
|