Tuesday, January 11, 2005

More garbage collector woes

I couple weeks ago, I recounted some trouble I was experiencing with the .NET garbage collector. My efforts to dispose and clean up objects, and eliminate unnecessary allocations (essentially, to be miserly with resources) brought a great deal of stability, performance, and peace of mind.

However, while much more rare, I still continued to experience random crashes in the application. This time, however, I was able to get Windbg to trap the TerminateProcess, allowing me to perform post-mortem. Here is what I discovered:

In one screen of my application, there is a PictureBox. This screen is displayed while the application is performing lengthy operations, the PictureBox contained an animated GIF. The purpose of this was to keep the user preoccupied while waiting (just like the waving flag at the top right of your browser while pulling down a page). Sounds pretty innocuous.

Well, as it turns out... behind the scenes, either the framework or Windows itself (I did not dig into the PictureBox MSIL to check) actually spins up a thread to pump the frame changes of the animation. Yes, this is a recipe for trouble. A rogue thread running in the system, whose obvious task is to update the GUI (it is pumping the animation). Hard Application crashes are a well-known side-effect of a background thread that does not synchronize all shared (UI) resource access with the owning thread.

So what was happening (confirmed by the smattering of PictureBox and lots of native WinAPI calls over the thread that triggered the crash) is that the animation pump thread was not properly coordinating with the UI thread that actually owned the PictureBox. Or perhaps it was behaving well under normal circumstances, but it was not observing the Garbage Collector's request to pause while the GC does it's thing. You see... the crashes all also happened to occur while the GC was performing a heap walk. While the GC thread is active, all other threads are *supposed* to be paused. But the animation thread was not. And thereby the waking of that animation thread to pump another animation frame, if it happened to wake while the GC was still walking the heap, would cause a very nasty crash.

Simply replacing the graphical content of the PictureBox with a static image (such as a JPG) eliminated the problem by virtue of the offending thread never being created in the first place (it is only created if you have an animated image loaded).

So my primary lesson from this is to simply not use an animated GIF in a PictureBox control. My secondary lesson is that it is still a very wise thing to explicitly clean up after yourself using Dispose() and Clear() on objects that support those semantics, and setting references to null for all non-value types as soon as they are no longer needed. Work *with* the garbage collector, not against it!

 

Tuesday, January 11, 2005 5:30:52 PM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [3] | 

The new Mac Mini

Apple just announced this really slick looking machine... the Mac Mini. I love the form factor, it reminds me of the old SPARC stations we used in college.

I sure would love to see a similar form factor MCE machine, priced around the same ($499). Right now, the best we can do with Media Center is the HP z540/z545 or a “build your own” using something like a D.Vine case from Ahanix.

Tuesday, January 11, 2005 5:06:31 PM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [0] | 

Interested in building your own Media Center Edition machine?

Perhaps, like me, you are contemplating building your own Media Center PC. Perhaps the HP set-top boxes are just too expensive. And the other products from Dell, Viewsonic, etc just look ugly or are too noisy. Well, Microsoft held a live Webcast session a couple days ago, covering the entire build process for putting together an OEM MCE system. Pretty much all you need to know about hardware selection, common issues, and configuration is covered. I tuned in, and found it to be quite informative to someone (like me) who has yet to attempt the building of one. And now, the recorded webcast has been made available for viewing. This link will take you to the registration page if you are interested (60 minute duration webcast).

Tuesday, January 11, 2005 3:10:56 PM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [1] | 

 Thursday, January 06, 2005

Portable Media Center competition

I just saw that there is already a linux-based offering in the PMC space. A company called ARCHOS is releasing the Pocket Media Assistant PMA400 this month (product specification page here). The feature list is very impressive, and it even claims to be capable of dealing with DRM-locked Windows Media files. And for under $800, it's quite an interesting device... especially considering it supports PDA functionality (touch screen!), wifi, wired ethernet, and even can record direct from cable/satellite.

This kind of competition is great, it will help push the envelope in the portable media and media center arenas.

 

Thursday, January 06, 2005 7:39:27 PM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [0] | 

Wanna see what Bill G has to say about Media Center PCs?

Bill Gates did the keynote for CES in Las Vegas, where he demo'd Windows Media Center Edition. Of course, like any Microsoft demo he ever does, it crashes at some point (I think they stage the crashes on purpose, to get media interest higher). The entire keynote is taped and can be viewed online at:

 

http://metahost.savvislive.com/microsoft/20050105/ms_ces_20050105_300.asx

 

***This link has been slashdotted, so the playback is a little rough right now. I recommend setting your media player to a 64k stream max with a sixty second network buffer before trying to view this...

Thursday, January 06, 2005 10:18:54 AM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [1] | 

 Tuesday, January 04, 2005

Old Media

A lot of lip service has been given to the “new media” lately, and I am as guilty of this as anyone. We like to talk about our MP3's, our DivX's, DVDs, media centers, iPods, blah blah blah....

But what about what is arguably the best media to be found? I am of course talking about the printed word: Books. They have been around far longer than any other communication device. And even in this era of eBooks, podcasts, and pay-per-view, they are still the absolutely best form of storytelling there is.

A perfect example: Rent “Starship Troopers” (~1997) and watch it with all of its special effects, cheesy lines, and ridiculous plots. If you make it through that (or at least far enough to follow my point), then go pick up Robert Heinlein's Starship Troopers (~1959) from a bookstore or your local library. There is no comparison. The original story is a masterpiece, especially considering that it was written in the 1950's. The movie is at best a mediocre mentally-void shoot-em-up special effects flick. I could list more examples (Lord of the Rings Trilogy) if I really wanted. Not in another hundred years will electronic story delivery be able to beat the tactile realness of a good printed book.

I had almost forgotten this, having been literally overwhelmed with all of the “new media technology” in the last few years. But today I happened to glance over at a bookshelf I had not payed attention to in four years. There, among the rows of books I had read, were six of them I had not. I had purchased and forgotten them. Such a waste (not of the money for the books - but of my time in the last four years). One book authored by Charles Sheffield, another by Robert L Forward, and the other four by my favorite author of all time, Greg Bear (I am so envious of Scoble).

I think it's also of no coincidence that for 4 years I have been having trouble keeping focused and motivated. Reading is a very healthy activity for the mind, and I have been neglecting this for too long now. I have recently taken the steps to rejuvenate my health (diet and exercises), but I have been forgetting to take care of my mind.

So as my first resolution for the New Year, I am going to read these six books. The 10 or so DVDs I was given for the holidays will just sit unused while I take this time to dust off the creative side of my brain.

I still cannot believe I ever allowed one of my favorite intellectual pastimes (hard sci-fi reading) fall away unnoticed like that...

 

Tuesday, January 04, 2005 7:29:29 PM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [2] | 

New phone devices coming from Samsung

Here is a link to some very interesting smartphone concept devices that were leaked from Samsung. I am especially intrigued by the third one:

Samsung "Thor"
Processor unknown, 3GB hard drive for memory, Bluetooth, GSM/GPRS, 18-bit Color 240x320 display, 4.45" x 1.89" x 0.83", and "MS Smartphone Magneto"”

Yes, this is a phone. With bluetooth and a 3G drive. No idea what “Magneto” is, but my guess is its a Smartphone version of Portable Media Center Edition. Wow, phone + camera + PDA + bluetooth + streaming media. This is really approaching the “all-in-one” personal device. I also notice it lists “Stereo BT Streaming” as a feature, and also “OTA / Online Music Service”... I don't suppose these will accept arbitrary sources. This could lead to *realtime* mediacasting if so.

Very promising direction here...

 

Tuesday, January 04, 2005 3:16:08 PM (Eastern Standard Time, UTC-05:00) #  Disclaimer | Comments [1] | 
View Keith Rome's profile on LinkedIn

On this page....

Archives

Navigation

Categories

Microsoft Weblogs

Web 2.0 / AJAX

Local Atlanta Bloggers

SharePoint / MOSS

WPF

Other Weblogs

MSDN Monitoring

My Blogmap

About

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Sign In

Certification Logo Certification Logo Certification Logo Certification Logo Certification Logo

Powered by: newtelligence dasBlog 2.0.7226.0