views:

267

answers:

3

Does a application in .NET need to be built in 64 bit to take full advantage of a machine with a 64 bit OS on it, or will it take advantage of it just as a 32 bit build. Basically, we have an issue with an out of memory exception and it was suggested to run the console app on a 64 bit box which "may" solve the issue. The question is can we just spin up a 64 box and throw the current app on it or do I need to rebuild the app in a 64 bit way.

+8  A: 

If your app is configured to build for the "Any CPU" platform, then it'll run appropriately on either.

Just make sure it doesn't use any 32/64 bit specific stuff, or you'll run into problems.

MSDN docs here.

For some discussion on drawbacks, see here

Nader Shirazie
+4  A: 

If it's built for any platform (the default), it will run in 64 bit on 64bit operating systems.

That being said, there are still potential issues to watch for. If you interface with native code (via p/invoke, C++/CLI, or COM), then you will need to port that code to 64 bit. If the application is 100% managed, it just works.

Reed Copsey
+1  A: 

"Any CPU" is your friend.

As an aside:

We had a particularly large Trie structure that exceeded the 2GB memory space of 32bit Windows. Because most of the structure comprised of object references, we found that the memory requirements of the app nearly doubled when moving to 64bit, requiring around 4gb. This is because the memory to store a reference is 64bits wide instead of 32.

spender