Are you sure it is the GC kicking in? Is your process attempt to access any
files, databases etc, because if it is these could be causing your random
stall. Also IMO a third of a second is an age for any computer.
If you search on Google you will find lots of good articles about garbage
collection in .Net - all the articles will tell you that garbage collection
is non deterministic, you can't predict or determine when it will run and you
can't control in the manner you require. What can be said about garbage
collection is that it will only run when system resources become scarce, i.e.
when the amount of memory available for the process starts to run low it will
attempt to free any unwanted memory.
If it is GC causing the stall then you need to analyse your application from
memory point of view, as in what objects are being created, are they being
used efficiently and disposed of correctly etc. This won't remove the
possibility completely that the GC will run during your critical phase but it
can reduce it.
HTH
Ollie Riches
"not_a_commie" wrote:
I have a tight time constraint on a small chunk of processing. It
takes about a third of a second to run. Occasionally, this function
will get stalled for (what I can only guess) is a garbage collection
(GC) run. Is there any way I can disable the GC for that brief third
of a second?