A key issue for time critical routines (think RTOS) on a Netduino is that application code may be preempted by the .Net MF for Garbage Collection ( see http://msdn.microsof...y/0xy59wtx.aspx for an explanation on how this works on a PC).
Since garbage collection takes time and impacts performance, one does not want it to get out of hand. Basically on the full framework it is so efficient that one hardly ever needs to worry about it for "normal" programs.
As a .Net programmer, I sort of assumed that garbage collection on the MF would be basically the same as on the full framework. Apparently this is not the case!
In watching this video ( http://skillsmatter....-the-path-of-go ) on porting a DLL from the full framework to the X-Box (which uses the compact framework), garbage collection turned out to be a major factor. David Stern spends a good part of the video explaining the differences in how garbage collection works on both the full and compact framework.
Unfortunately he does not address GC in the micro framework, and I have yet to find a good resource that does.
I highly recommend this video to anyone wanting to learn more about how garbage collection works.
Garbage collection in the .Net MF
Started by JonnyBoats, Mar 29 2011 01:38 AM
3 replies to this topic
#2
Posted 29 March 2011 - 04:55 AM
Interesting video. Given that the Compact Framework only implements one-generation GC, I wouldn't imagine that the Micro Framework is any different.
Which leads to an equally interesting observation:
In a one-generation GC, every live object on the heap must be considered during each garbage collection. Therefore, the more long-term objects in a NETMF application, the slower the GC cycle. Reducing the number of long-term objects should improve overall GC performance.
If correct, that observation will certainly have a bearing on the way I code my NETMF apps.
- Adam
#3
Posted 29 March 2011 - 05:58 AM
The garbage collector in .NET Micro Framework is a simple mark-and-sweep.Given that the Compact Framework only implements one-generation GC, I wouldn't imagine that the Micro Framework is any different.
#4
Posted 29 March 2011 - 04:43 PM
The garbage collector in .NET Micro Framework is a simple mark-and-sweep.
So do you think that it is a good strategy to avoid long-term objects as much as possible in NETMF code?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users