473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3573
I don't know how you can prevent the GC, but you can force the GC to
collect:
System.GC.Colle ct()

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******** ******@TK2MSFTN GP11.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
QueryPerformanc eCounter

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******** ******@TK2MSFTN GP11.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 "measuremen t 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******** ******@TK2MSFTN GP11.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******** ******@TK2MSFTN GP11.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
2298
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 then throws them away and then monitors the garbage collection and store statistics on it, preferably in C#. I want to know what is the longest...
6
810
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
2715
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 this? Is it because C is generally a 'low level' language and they didn't want garbage collection to creep into C++ and ruin everything? Just...
34
6367
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, probably a few hundred lines of code in Python. There is a need to interact with network using the socket module, and then probably a need to do...
8
3021
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 the mainline. The class that instantiated the object in question is definitely still in existence at the point garbage collection swoops in and...
28
3139
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 this work be library based or language based and will it be based on that of managed C++? Then of course there are the finer technical questions...
56
3621
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 = null; Private Microsoft.Office.Interop.Outlook.NameSpace _Namespace = null; The Constructor: public OutlookObject()
350
11517
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 one, and in what percentage of your projects is one used? I have never used one in personal or professional C++ programming. Am I a holdover to...
158
7710
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 discouraged due to some specific reason. If someone can give inputs on the same, it will be of great help. Regards, Pushpa
0
7410
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7668
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7923
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7773
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5984
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.