Can't Allocate More RAM to Minecraft
-Xmx
is for the maximum heap space. It doesn't tell Java this is what should be started with, but is the maximum. -Xms
is for the minimum, so what the JVM starts with. But really, what it starts with is a much smaller concern than the maximum.
That being said, if you observe that the issue comes when you go beyond 4GB RAM, that is a clear indicator that what you have is a 32-bit program. Whatever you did to ensure you use 64-bit Java can't have been right.