Would it be only the memory capacity that is limited to 4 GB in 32 bits?
Do I need to have specific concerns?
I know what's different about C, I want to know about C #.
Would it be only the memory capacity that is limited to 4 GB in 32 bits?
Do I need to have specific concerns?
I know what's different about C, I want to know about C #.
You should know that the 32-bit pointer has 4 bytes and 64-bit architecture has 8 bytes. This has deep internal changes in .NET.
The memory consumption of all objects that have pointers will be larger. Although C # does not have free pointers (except in context unsafe
) there are opaque pointers in everything it is a type by reference, since the pointer is the mechanism to get the reference.
The consumption of the object itself increases even if it does not have members by reference. Every object in heap needs two CPU words , one of which is a pointer to the type of that object that is important for reflection, memory management by the garbage collector and polymorphism. The other word has multiple functions and can be a pointer as well, and should be the same size as the previous word up because questions of alignment .
So it's obvious that with the pointer, this header that every object has will be larger.
In addition, the type IntPtr
has its size changed since it is pointer.
If I remember anything else I post.
More information to complement Rodrigo's responses and bigown.
If you compile the application as 64-bit, it will not run on machines with 32-bit (or less) processors.
Since we have not seen this kind of machine in a long time (Windows XP already had 64-bit versions in the middle of the Jurassic period), this would only be a problem if you tried to run an application in a museum piece. But I think it's worth mentioning, anyway.
Now, seriously, the only practical application I see for 32-bit compilation is to upgrade DLLs to 32-bit applications - and those still exist and are very common. If you are upgrading a DLL from such an application, you have to keep the bit pattern, otherwise there will be incompatibility.
In addition to memory, there are other yes:
BadImageFormatException
IntPtr
for example, have different sizes. ReadProcessMemory
may fail when a 32-bit process tries to read from a 64-bit process. You will encounter problems depending on the complexity of the application.