Does a 32-bit process require more memory when running on a 64-bit system?

I have a pretty hungry memory java application. On my 32-bit systems with Windows XP Professional, the application will work fine if I give it to him -Xmx1280m. Everything below is in the exception java.lang.OutOfMemoryError: Java heap space.

If I run the same application on 64-bit Windows XP Professional (everything else is exactly the same), it is required -Xms1400mto prevent the OutOfMemory condition.

As far as I understand, if I have a program in C and I will compile it for 32-bit and for 64-bit, the 64-bit version will require more memory, since pointers are wider and so on. However, in my Java example, the virtual machine (Sun) is the same, and the bytecode is the same.

Why do I need additional memory on a 64-bit machine?

+3
source share
3 answers

Probably, since the implementation of the virtual machine differs from the 32/64 bit architecture in such a way that it consumes more memory (wider types, different GCs).

The bytecode does not matter when it transfers tasks to the base system. I'm not sure that Java and memory efficiency are two terms that I would put together: P

+5
source

Despite the fact that your bytecode is the same, the JVM converts it to machine code, so it has all the same reasons as for C, which requires more memory.

+4
source

For the same reason that you have already specified for program C. A 64-bit system uses large memory addresses, which leads to its “leak” (I believe that the term that I heard used to describe it).

+3
source

Source: https://habr.com/ru/post/1711695/


All Articles