473,324 Members | 1,856 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,324 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 3532
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.