About the author

Steven HarmanSteven Harman is a passionate developer who believes that writing great software isn't just a job, its a craft.

ASP.NET MVP

For recent posts and more about me, scroll to the bottom.

Subscribe

  • Subscribe to my feed. via RSS
  • Subscribe via email via email

Jobs

Badges

  • Subtext Project
  • Support Subtext
  • HiddenNetwork.com Banner

Hacking Visual Studio to Use More Than 2Gigabytes of Memory

Visual Studio can be a tremendous resource hog, especially if you have a large solution and you're using a productivity add-in or two.

On my current project we're running VS 2008, we've got just under 20 projects in the solution, and several of us are using the ReSharper 4.0 EAP nightly builds to enhance our dev-fu. And you know what... we're restarting VS at least a half dozen times a day to work around a nasty exception we regularly encounter while trying to compile:

Not enough storage is available to complete this operation.

Not enough storage...?

Yep - storage. But you should read storage to mean memory... RAM that is.

After running for a while the Visual Studio process (found under devenv.exe in process explorer) maxes out its available memory and the above exception is thrown. The only way to reclaim the memory and successfully compile the solution is to restart the process. Bummer!

Maybe we should just upgrade our hardware, right?

I mean, with cost of processor cycles and RAM falling as fast as gas prices are rising, why not just spend a few bucks and make sure we're all running multi-core boxes with 4+ Gigabytes of memory and storage space to burn. Well guess what... we are.

All of the developers are running nice beefy machines with lots of RAM, super-fast processors, and we even have nice 21" wide screen DVI monitors. So this ain't no hardware problem.

Its a software problem.

I will admit, we are running a mix of 32-bit operating systems - mostly Vista with a handful of XP machines mixed in for the devs that roll that way. And Jeff Atwood has covered the missing RAM problem before, but even switching to a 64-bit OS wouldn't solve our problem. At least not entirely.

The problem is with Visual Studio. Being a 32-bit application its limited to just 2GB of virtual memory, even if its running in a 64-bit OS. At least, its limited to 2GB by default... but we can hack around change that.

The hack... err, solution.

Gimme 3GB!The first thing to do is tell the OS to increase the amount user-mode memory from 2GB to 3GB. If you're running a 64-bit you can skip this step.

  • for Windows XP: Backup the boot.ini file and then put the /3GB switch in your boot.ini. (more information on the /3GB option)
  • for Vista: run the following from the Visual Studio command prompt (Brad Rutkowski has the full scoop):
       1:  BCDEDIT /Set IncreaseUserVa 3072

Then we have make Visual Studio large address aware.

  1. Be sure to backup devenv.exe
  2. Using the Visual Studio command prompt, navigate to C:\Program Files\Microsoft Visual Studio 9\Common7\IDE\
  3. execute the following command:
       1:  editbin /LARGEADDRESSAWARE devenv.exe

Finally we'll use the old Microsoft-fix-all - reboot the machine. Bounce that box!

Look at all that memory!

More memory, FTW! At this point Visual Studio should be allowed to consume up to 3GB of memory before throwing that ugly out of memory exception.

Just to show you I'm not lying, I grabbed a screen shot of my process explorer with devenv.exe process chewing up more than 2.5GB of memory. Sweet!

Note: even with our large solution and running the early, and memory-hungry, ReSharper bits, Visual Studio typically stays around or just above the 2GB mark. However it can spike up to 2.5+ GB while compiling, as show in this screen shot.

kick it on DotNetKicks.com

Technorati Tags: , , ,

The Developer Exchange Program

This week I was having a conversation with some fellow developers at the ALT.NET Open Spaces conference and an interesting topic came up. We were talking about vast amounts of time, mostly personal time, we spend trying to improve our skills and our craft. We spend time reading and writing blogs, books, mailing list messages, attending and giving talks, contributing to Open Source, and reading and writing code.

We spend a huge number of hours in the quest for continuous improvement.

Self-teaching is good

We all agreed that self-teaching is important and we do it because we enjoy it, but man does it take a lot of time. For many of us that means we sacrifice or compromise when it comes to time spent with families, friends, and other parts of our lives.

Why? Because we're thirsty for knowledge and we know that others are out there doing things differently, and possibly better. We hope that by learning from them we can improve ourselves and our craft in the larger sense.

After some war stories and one-uppers we realized something. It be great if we could spend more time working with, and learning from, each other... in person! Ideally resulting in less wasted time banging our heads into the keyboard and more time doing other life stuff.

Learning from each other is better

What if we could each spend a few days a quarter at another developer's job, pairing with and observing he and his team work. Just being able to experience someone else's take on Scrum/XP, BDD, etc... would be awesome. The potential for cross-pollination and exchange of ideas and practices is almost limitless.

And think about how much faster we could learn in person. With such an immediate and personal feedback loop we might just find ourselves with enough free time to try to regain some of those things we're giving up now.

Scott Bellware doing the BDD thing... I have no doubt that going to observe Scott Bellware's team in action for a few days - or even better, an entire iteration - would have resulted in me learning more about BDD and challenging more of my own, and hopefully some of their, thoughts and understandings than I got six months of going it alone. And that translates to fewer nights with in front of my computer until 3am, and more time for the rest of my life.

And what about you? Wouldn't you love to go hang with Jeremy Miller and see how he runs his teams and with any luck, have some of his ReSharper-fu rub off on you?

Or see just why Aaron Jensen and Jacob Lewallen (a.k.a.: the Eleutian guys) love that AutoMocking Container so much? And believe me, they are stupid-smart guys!

How much better a developer would you be if you could regularly observe another Agile team in action... in person.

kick it on DotNetKicks.com

There's a Glitch in the System, I'm a Microsoft MVP

ASP/ASP.NET MVP Today I received an email informing me that I've received a Microsoft MVP Award in the ASP/ASP.NET category. Woot!

Yeah, I realize its a whole day after all of the other MVPs received their renewal notices and all new MVPs got their emails, but hey... better late than never!

Actually, it seems the joker that originally nominated me messed up my email address and as a result my notification email got lost in the ether. But they eventually fixed the glitch, I received the notification email, and Rob is still my homey.

So what exactly does it mean to be a Microsoft MVP?

Actually... I'm not really sure yet. But I do know it means I'll be traveling to Redmond in two weeks for the 2008 MVP Global Summit, so that's something! I also get to put that snazzy logo on my blog, and I do loves me some snazzy badges. :)

Seriously though, I really appreciate the honor and would like to thank Rob Conery for initially nominating me and Phil Haack for submitting a second nomination - likely causing the buffer overflow that resulted in me be awarded the MVP status.

No takesies backsies!

Technorati Tags: , ,

Run your MbUnit Tests from ReSharper 4.0!

I just saw that Albert Weinert has upgraded the MbUnit test runner plugin to work in ReSharper 4.0, sweet! Since ReSharper 4.0 is still in pre-beta, there is no guarantee that it will work at all, but I'm running the latest nightly builds and IMO its getting more stable every day.

MbUnit ReSharper Test Runner I verified that the MbUnit test runner plugin does work by installing it on against ReSharper 4.0 build 758 and opening the Subtext 1.9 Branch source code. The image to the left shows the ReSharper Unit Test Explorer open and displaying the MbUnit tests from Subtext.

Having such tight integration with ReSharper goes a long way in delivering the kind of frictionless development experience that I'm after. Though to be honest, I'm still a huge fan of TestDriven.net - you just can't beat the Right-click -> Run Test slickness that it brings to the table.

That being said, I know not everyone has TestDriven.net, but a lot of folks are already using ReSharper to increase their productivity and reduce daily development pains. And being able to run MbUnit tests right inside the IDE, via ReSharper, will reduce those pains even more... Low Friction == More Better!

And hopefully this plugin will open a few doors for MbUnit - my xUnit test framework of choice - and increase its adoption rate and market share. :)

So what are you waiting for... go get you some ReSharper + MbUnit love!

Lightning Talk Recap:15 Minutes with Rhino.Mocks

At last week's CONDG meeting I gave a lightning talk on Rhino.Mocks. Overall I think the talk went pretty well - the talk was voted second best of the night, following Jon Kruger's talk on LINQ to SQL.

But that's OK with me. I knew a topic like mocking would be a hard one to cover in just 15 minutes. My goal was just to get people interested so they would go out and investigate some more on their own.

And judging by the questions I got during the one minute Q&A at the end of my talk and the conversations I had after the meeting during our geek dinner, I think I accomplished my goal.

Its about sharing what I know

As part of my quest to eat like a bird and poop like an elephant - when it comes to consuming and sharing knowledge that is - both the slide deck and small sample application from the talk are now available out in the Code Incubator project's SVN repository. Or you can optionally get them as a .zip file download, but I'd recommend using the SVN repository for the most up to date bits.

I'm planning to do a short mini-series of posts covering Rhino.Mocks in which I'll cover some of the basics, and also dive into some of higher-level discussions. So stay tuned! :)

Meme: How Does an Open Source Guy Pack?

The crazy-hott company I work for is getting ready to move into new, swanky, techno-stuffed digs. Yesterday was packing day for the delivery center - where my group of super-consultants live - and in honor of the event my grand-boss, Brian Prince, started a little meme: How does an XXX guy pack?

Brian tagged several of his minions with variations of the meme and surprise, surprise... I'm Open Source Guy.

In OSS, this is how we roll...

Similar to how a tools nerd packs, an Open Source guy would first take a look at the lay of the land to see what else is out there. With any luck there is already a similar packing project already up and running.

Not wanting to re-invent the wheel he'd prefer to just join forces with the project that already underway and save some time and energy. In the best case he may not need to pack a single box at all as the community would have done all of that already!

If for some reason that other packing project isn't exactly what OSSG was looking for, no biggie. He'd just fork the project and leverage as many of the already packed boxes as possible and only have to pack a few boxes on his own.

With any luck, he'd find a few other souls that were going through a similar packing/move and they'd decide to join up with OSSG... possibly packing a few boxes for him, maybe just lending a hand here-and-there, or opening bug reports keeping a checklist of TODOs.

Starting a new move...

In the very worst case, OSSG might find there are no existing packing project that meet his needs. In that case he'd need to start one on his own, from scratch.

The first thing he'd do is pick a license, I'm a fan of the New-BSD style license. Then he'd pick a mechanism to host the packing materials, supplies, and packed boxes. He'd want something that provided version control packing history, feature tracker TODO list, issue tracker, a low barrier to entry, etc... Likely something that was FREE (as in beer), scalable, and had some amount of public exposure.

As an agile kinda-guy, and a believer in TDD/BDD, he'd then write some stories. Next he'd move into writing some specs (tests in TDD parlance). These specs would help him clearly define what should happen when the various boxes are packed.

With the specs in hand he'd pack just enough in the boxes to meet his spec, no more... no less. Then he's write a new spec and the implement it, continuing in this pattern ad nauseam.

When OSSG feels he's got a good number of boxes packed, and the move at least underway, he'd announce it to the world and invite others to join him. With some luck he'll drum up some interest and start building a community around this packing project. Working as a team the community would start to contribute and before long boxes are being packed more efficiently, with greater innovation, and fewer broken goods than the commercial moving companies.

The next thing he knows, all of OSSG's boxes have been packed and now the community is actually packing other boxes. And even better, they're filling the boxes with cool and innovative items that he'd never thought of. How exciting!

Commercial packers get involved

Of course after a while those commercial movers catch on and decide to re-implement a half-assed version of the packing project. Then they start peddling it to customers as if its the next silver-bullet, one-size-fits-all solution to all of their packing problems.

Naturally the Twitterati, blog-o-sphere, and mailing lists explode into a series of discussions, flame wars, and trolling.

Not wanting to miss out on an opportunity to be snarky and point out the idiocracy of many involved, some one starts ghost writing a blog to highlight the bitch-and-moan-fest. Soon many realize they can stop following the mailing lists and just get the highlights, chock full of witty and berating banter, directly from the ghost writer.

In the end...

OSSG was able to get all of his boxes, plus lots of other goodies, packed and moved... and he was able to help others along the way.

But after all of the bickering he feels a bit disenfranchised and decides maybe its time to give up on his pipe dream of finding a rich benefactor to pay him to work on building the best OSS packing tools around.

He decides that building real solutions using sound principles is just too much pressure... he'd rather spend his day talking about pie-in-the-sky ideas, with unrealistic goals, never getting his hands dirty with the technologies he's pushing.

So, he becomes a non-coding software architect.

Technorati Tags: , , , ,

15 Minutes with Rhino.Mocks

Rhino.Mocks - fluent mocking At next week's CONDG meeting I'll be giving a Lightning Talk on my favorite .net mocking framework, Rhino.Mocks.

As I sat down to start planning my talk I realized I had a little problem - how do I cover such an extensive and powerful tool in just 15 minutes?

The answer: I don't

Even if I spewed out words at a rate comparable with a world-class auctioneer I still couldn't cover everything I wanted to. Off the top of my head...

  • Mock vs. DynamicMock vs. PartialMock vs. Stub
  • what's the deal with expectations?
  • Record... Playback... WTF?
  • what are those criteria things?

And what about the tangential discussions on topics like

  • mocks vs. stubs vs. fakes vs. test doubles... what's the big diff?
  • mocking is an integral part of TDD/BDD
  • following DIP makes mocking easier
  • what about auto-mocking IoC containers?

With so much to talk about, how can I possibly pare it down to just 15 minutes?

I don't, YOU do!

Pretend for a minute that you were going to be at that meeting... what about Rhino.Mocks would you want me to discuss. There are no right or wrong answers here, I just need some guidance. What is it that people want and/or need to know about mocking with Rhino?

Oh, and don't limit yourself to the topics I've discussed above... anything goes. So lay it on me!

Ready... GO!

Technorati Tags: ,

ReSharper 4.0 EAP Nightly Builds are Now Available!

Ilya Ryzhenkov just announced (via in the #alt.net IRC channel) that the ReSharper 4.0 EAP nightly builds are now live! Oh, and apparently he hinted at the news yesterday but the bits didn't appear for download until today.

Get the latest bits from the Nightly Builds site.

I'd also recommend keeping an eye on the the ReSharper 4.0 EAP Notes for up to the minute information on the new 4.0 features. There is some seriously cool stuff in there - like Completion with CamelHumps!

Superman, the yellow sun has risen once again! :)

kick it on DotNetKicks.com

Technorati Tags: , ,

Ruby Has Ranges, and So Does C#

Creating a Range in Ruby is dead simple.

   1:  my_range = (1..10)
   2:   
   3:  my_range.each { |i| puts "My number is: #{i}." }

Running that little snippet will do just what you think, push the numbers 1 through 10 out and shove them into the sentence my number is x.

   1:  My number is: 1.
   2:  My number is: 2.
   3:  My number is: 3.
   4:  My number is: 4.
   5:  My number is: 5.
   6:  My number is: 6.
   7:  My number is: 7.
   8:  My number is: 8.
   9:  My number is: 9.
  10:  My number is: 10.

This code isn't all that useful as is, but being able to concisely construct a range can be very useful. Ranges often come in handy when writing unit tests, making lists, and a number of other places.

And in F# too...

Many, maybe even all... I didn't check :), functional language also provide a convenient way to build a range. F# is no exception and its syntax looks a lot like Ruby's.

   1:  myRange = {1 .. 10} // this is just an IEnumerable<int> 

If you're interested in learning more about F#, check out Dustin Campbell's excellent series on why he loves F#.

And what about C#?

Too bad we don't have such a nice, concise syntax in C#, huh?

Yeah, too bad. But as of C# 3.0 we do have something close, the Enumerable class!

   1:  IEnumerable<int> myRange = Enumerable.Range(1, 10);
   2:   
   3:  IEnumerable<IWidget> mySequence = Enumerable.Repeat(someWidget, 10);

Note: Enumerable actually lives in the System.Linq namespace.

No, its not quite as concise as the Ruby or F# examples above, but it is a heck of a lot better than having to write some kind of loop to build up the range.

In line #1 we're saying we want a Range that starts at 1 and has a length of 10. That is, it contains the values 1 through 10... just like we'd expect.

Oh, and line #3 isn't really a Range, its called a Sequence. In this case mySequence is some kind of IEnumerable with one object repeated 10 times.

Don't you just love finding little nuggets that can turn mundane code into trivially simple code. Enjoy!

Technorati Tags: , , ,

On Geek Hero Worship

After last night's Columbus Ruby Brigade meeting several of us were over at a local watering hole soaking up some Guinness and a great conversation. Like all great conversations, at some point the conversation devolved into war stories, then then one-upsmanship, and finally a lot of hero worship.

And no adulation is complete until some one points out that those folks we put up on pedestals are normal people, much like the rest of us.

Of course being a bunch of Ruby enthusiasts, with several bordering on fanatics, that statement when something like

They write their code just like everyone else, one test spec at a time.

Yeah, that's right... BDD, FTW!

Technorati Tags: , ,