The Mystery of the Misbehaved Malloc

2016-07-29 Thread 岩倉 澪 via Digitalmars-d-learn
So I ran into a problem earlier - trying to allocate 2GB or more on Windows would fail even if there was enough room. Mentioned it in the D irc channel and a few fine folks pointed out that Windows only allows 2GB for 32-bit applications unless you pass a special flag which may or may not be a

Re: The Mystery of the Misbehaved Malloc

2016-07-29 Thread ag0aep6g via Digitalmars-d-learn
On 07/30/2016 07:00 AM, 岩倉 澪 wrote: auto mem = malloc(2^^31); 2^^31 is negative. 2^^31-1 is the maximum positive value of an int, so 2^^31 wraps around to int.min. Try 2u^^31.

Re: The Mystery of the Misbehaved Malloc

2016-07-29 Thread 岩倉 澪 via Digitalmars-d-learn
On Saturday, 30 July 2016 at 05:21:26 UTC, ag0aep6g wrote: On 07/30/2016 07:00 AM, 岩倉 澪 wrote: auto mem = malloc(2^^31); 2^^31 is negative. 2^^31-1 is the maximum positive value of an int, so 2^^31 wraps around to int.min. Try 2u^^31. bah, I'm an idiot! CASE CLOSED. Thanks for the