[unsigned] No, you can't address full address space in D

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 20 09:21:42 PST 2016


On Sat, 20 Feb 2016 17:04:11 +0000, Kagamin wrote:

> It doesn't even compile: http://dpaste.dzfl.pl/ec0f5183e42e

Check the error. Add a `cast(size_t)` in there. Try again.

That's still doomed to failure. You're not leaving space for the stack 
(which has preallocated address space) or application binary (which is 
memory mapped from the file and takes up address space). You're using the 
garbage collector, which has to allocate its own internal data structures 
somewhere.

If you subtract those from your allocation request, you still won't see 
much success. There's no guarantee where in memory those items will be 
allocated, and if your system has ASLR turned on by default, it's even 
less predictable.

If you tried a similar thing in C, you'd see the same problems.


More information about the Digitalmars-d mailing list