64-bit Pointer Limitations
Discussions focus on how 64-bit architectures like x86_64 and ARM64 use only 48 bits for addressing instead of full 64, enabling pointer tagging, compression, and optimizations for cache efficiency and memory savings.
Activity Over Time
Top Contributors
Keywords
Sample Comments
Current intel 64 bit machines only have 57 bits of address space. The top bits of the pointers are wasted.
Doesn't the opposite happen with 64 bit pointers on x86_64? the lower bits have no use so they get used for tracking if a memory segment is in use or other stuff
With a 64 bit pointer you could make it bit addressable.
What would a 64bit address space solve that a 128bit would break?
Your CPU can handle 39-bit physical memory addresses (up to 512 GB of physical memory), and 48-bit virtual addresses (256 TB). Your operating system maintains a mapping from virtual to physical addresses, usually arranging the map so that every process has a separate memory space. Pointers are all still 64 bits long though.
Nothing on x86_64 is returning "full 64 bit pointers", unless they are also playing games, as CPUs only support 48 bits of address space.Also, your suggestions are a bit strict, in my opinion. Every VM or interpreter I know about uses this kind of trick, usually to squish things like integers. Not doing this requires adding an extra allocation for every integer.
The value in the pointer is an index into an array of 64bit ints rather than bytes. This lets you address 32GB with a 32bit pointer rather than 4GB.
If everything you point to is aligned on an eight-byte boundary, and if you don't use type tags, then a 32-bit pointer can point to anything in a 35-bit address space. So you can get up to 32 GB.
Both are bigger than the x64 address space...
Last time I looked, the current 64bit Intel CPUs only used the lower 48 bits for userspace virtual addresses. This leaves 16 bits available if you want to tag your pointers with some additional information. This can be useful for saving space or using them with an 8 byte cmpxchg.This kind of trick is easier to get away with if you know exactly which CPUs your software is going to run on. Otherwise your software could break horribly when a new generation of CPU comes around.