[phobos] Phobos unit tests running out of memory

Rainer Schuetze r.sagitario at gmx.de
Tue Sep 4 12:38:52 PDT 2012


On 04.09.2012 19:24, David Simcha wrote:
> I think we need separate compilation for non-unittest Phobos compiles,
> too.  Antti-Ville's precise heap scanning, which will hopefully be
> integrated soon (I've been meaning to ping him on that) makes the
> non-unittest Phobos build process run out of memory on Windows because
> of all the template instantiations necessary.  Alternatively, we could
> bring back the compile time GC.  Walter, why was compile-time GC removed
> again?
>


IIRC it was removed because compile times more than doubled.

Regarding the bail out with less than 1 GB allocated I suspect that the 
dmc runtime uses VirtualAlloc with sizes below the allocation 
granularity (which is 64kB on 32-bit windows). This waists virtual 
address space, so another allocation fails even if the actually 
allocated physical memory is well below the 2GB limit.

The MS-cl-compiled version of dmd does not exhibit this problem (and 
compiles D code considerably faster).

With a 64-bit host (or with the /3GB boot switch on 32-bit XP), the 2 GB 
limit can be extended up to 4 GB if the application is "large address 
aware". Unfortunately optlink cannot set the corresponding bit in the 
executable header, so you'll have to patch the executable with another 
tool (like this one: 
https://github.com/rainers/visuald/blob/master/tools/largeadr.d )

This problem also affects all optlink generated D programs.



More information about the phobos mailing list