Re: allocated object address as high as 46th bit (i.e in the 131072 GB range)
The reason high bits are often set is because an address layout is actually 4 indicies into the page table and a page byte offset. So all the way to bit 48 there is index info the cpu uses.
Re: allocated object address as high as 46th bit (i.e in the 131072 GB range)
On Monday, 9 October 2023 at 05:57:47 UTC, Richard (Rikki) Andrew Cattermole wrote: As far as I'm aware, no cpu that you can get ahold of support more than 48bit of address space at the hardware level. There is simply no reason at this time to support more, due to the fact that nobody has implemented anywhere near that maximum. Also worth noting, the address a block of memory is, has no relation to the hardware. A kernel will instruct the cpu to map it wherever it pleases per process. Thanks for the info. I'm surprised that kernel set virtual space that high.
Re: allocated object address as high as 46th bit (i.e in the 131072 GB range)
As far as I'm aware, no cpu that you can get ahold of support more than 48bit of address space at the hardware level. There is simply no reason at this time to support more, due to the fact that nobody has implemented anywhere near that maximum. Also worth noting, the address a block of memory is, has no relation to the hardware. A kernel will instruct the cpu to map it wherever it pleases per process.
allocated object address as high as 46th bit (i.e in the 131072 GB range)
https://dlang.org/library/core/bitop/bsr.html I'm trying to find out allocated object's address' space: ``` import std.stdio; import core.bitop; void main() { const size_t ONE_G = 1 << 30; char[][128] ptrs; foreach (i, ref ptr; ptrs) { ptr = new char[ONE_G]; if (ptr is null) { break; } writeln(i, ": ", bsr(cast(size_t)ptr.ptr)); } } ``` I tried on a few 64-bit machines (all of them have less than 128GB memory), and the result are about all the same: ``` $ uname -m x86_64 $ ./bit_op 0: 46 1: 46 2: 46 3: 46 4: 46 5: 46 6: 46 7: 46 8: 46 9: 46 10: 46 Killed ``` What puzzled me is that the highest set bit of the allocated address are all 46! i.e in the in the 2^47 ~= 131072 GB range! I know this could be an OS thing, but just wonder if anyone can give me some explanation? Thanks.