473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Garbage Collection

Hello:

We are considering developing a time critical system in C#. Our tool used in
Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000 measurement exactly 10 ms apart. In the
future this may decrease to 5ms ). I am concerned that if garbage
collection invokes during this time it may interfere with our measurement
results. I have looked over the garbage collection mechanism and see no way
to control when garbage collection occurs. Is there a way to pause and
start garbage collection? or some other technique that I can use to prevent
garbage collection while I am taking measurements?

Thanks

Bob
Nov 15 '05 #1
5 3540
I don't know how you can prevent the GC, but you can force the GC to
collect:
System.GC.Collect()

How are you measuring time spans?

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Bob lazarchik" <bo*****@yahoo.com> schreef in bericht
news:eN**************@TK2MSFTNGP11.phx.gbl...
Hello:

We are considering developing a time critical system in C#. Our tool used in Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000 measurement exactly 10 ms apart. In the
future this may decrease to 5ms ). I am concerned that if garbage
collection invokes during this time it may interfere with our measurement
results. I have looked over the garbage collection mechanism and see no way to control when garbage collection occurs. Is there a way to pause and
start garbage collection? or some other technique that I can use to prevent garbage collection while I am taking measurements?

Thanks

Bob

Nov 15 '05 #2
QueryPerformanceCounter

Bob
Nov 15 '05 #3
Bob,

It depends on what you mean by "precise". Windows in general doesn't make
timing guarantees, nor does the runtime, so I don't think you can do this
easily with a purely PC-based solution. Or, in other words, you can't do
"hard" real-time on Windows (and even soft real-time may take some work).
You might be able to get it to work (or make it close enough for your
application), but there are no guarantees on it continuing to work.

Can you do the sampling with hardware and then send it to a PC (or handheld)
over a serial link? That would give you buffering and make sure that you had
the samples at the right points.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://weblogs.asp.net/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
"Bob lazarchik" <bo*****@yahoo.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
Hello:

We are considering developing a time critical system in C#. Our tool used in Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000 measurement exactly 10 ms apart. In the
future this may decrease to 5ms ). I am concerned that if garbage
collection invokes during this time it may interfere with our measurement
results. I have looked over the garbage collection mechanism and see no way to control when garbage collection occurs. Is there a way to pause and
start garbage collection? or some other technique that I can use to prevent garbage collection while I am taking measurements?

Thanks

Bob

Nov 15 '05 #4
I may not be popular for suggesting this, but I'd recommend that you write
your measurement collection functions in unmanaged C++, and pass them into
the C# application for the rest of the work. You will get much better
control over timing.

If you are going to collect 1000 or 2000 measurements, and then stop
collecting, and then process data, you may be fine simply invoking garbage
collection at "safe" times (like before your data collection begins or after
it ends). On the other hand, if you collect your data using C# code, you
may have to have a way to prove that your measurements actually occurred at
10ms intervals, given that GC can occur at any time, and a plan for
collecting data again in the event that the first "measurement window" was
messed up by GC. IMHO, you are better off using unmanaged code for
fine-tune real-time measurements.

HTH,
--- Nick

"Bob lazarchik" <bo*****@yahoo.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
Hello:

We are considering developing a time critical system in C#. Our tool used in Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000 measurement exactly 10 ms apart. In the
future this may decrease to 5ms ). I am concerned that if garbage
collection invokes during this time it may interfere with our measurement
results. I have looked over the garbage collection mechanism and see no way to control when garbage collection occurs. Is there a way to pause and
start garbage collection? or some other technique that I can use to prevent garbage collection while I am taking measurements?

Thanks

Bob

Nov 15 '05 #5
In addition to caveats from other posters.

Bear in mind that Windows is not a hard real-time operating system. You may
be hard pressed to do 1000 measurements at exact 100ms intervals, let alone
10ms or worse still 5ms, even in a device driver written in assembler. The
basic time tick in Windows is 10ms or 15ms, so doing anything at intervals
shorter than that is almost doomed to failure, especially in a managed
language.

I think garbage collection will be the least of your worries.

Best Regards
Julian Nicholls

"Bob lazarchik" <bo*****@yahoo.com> wrote in message
news:eN**************@TK2MSFTNGP11.phx.gbl...
Hello:

We are considering developing a time critical system in C#. Our tool used in Semiconductor production and we need to be able to take meaurements at
precise 10.0 ms intervals( 1000 measurement exactly 10 ms apart. In the
future this may decrease to 5ms ). I am concerned that if garbage
collection invokes during this time it may interfere with our measurement
results. I have looked over the garbage collection mechanism and see no way to control when garbage collection occurs. Is there a way to pause and
start garbage collection? or some other technique that I can use to prevent garbage collection while I am taking measurements?

Thanks

Bob

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob | last post by:
Are there any known applications out there used to test the performance of the .NET garbage collector over a long period of time? Basically I need an application that creates objects, uses them, and...
6
by: Ganesh | last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a process without have access to the process code. regards Ganesh
11
by: Rick | last post by:
Hi, My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind...
34
by: Ville Voipio | last post by:
I would need to make some high-reliability software running on Linux in an embedded system. Performance (or lack of it) is not an issue, reliability is. The piece of software is rather simple,...
8
by: mike2036 | last post by:
For some reason it appears that garbage collection is releasing an object that I'm still using. The object is declared in a module and instantiated within a class that is in turn instantiated by...
28
by: Goalie_Ca | last post by:
I have been reading (or at least googling) about the potential addition of optional garbage collection to C++0x. There are numerous myths and whatnot with very little detailed information. Will...
56
by: Johnny E. Jensen | last post by:
Hellow I'am not sure what to think about the Garbage Collector. I have a Class OutlookObject, It have two private variables. Private Microsoft.Office.Interop.Outlook.Application _Application =...
350
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use...
158
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.