www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Out of memory during compilation

reply Matt Gamble <gamblemj gmail.com> writes:
I have a large program (for me) with several thousand lines of 
code. Recently when I've tried to compile under debug (-g 
-unittest)  with VS2017, dmd2.076.1, windows 10, 8Gb ram), I've 
had the following output:

Compiling SKaTERoptimizerD.d...
Fatal Error: Out of memory
Building x64\Debug\SKaTERoptimizerD.exe failed!

When compiled under release (-O -release -inline 
-boundscheck=off) mode it works fine.

Any advice on how to combat this? Do I need to start compiling 
DLLs? Does that change how the linking would be done? Would that 
affect the debugger?

Any help is appreciated,
Matt
May 02 2018
next sibling parent reply Joakim <dlang joakim.fea.st> writes:
On Wednesday, 2 May 2018 at 14:25:35 UTC, Matt Gamble wrote:
 I have a large program (for me) with several thousand lines of 
 code. Recently when I've tried to compile under debug (-g 
 -unittest)  with VS2017, dmd2.076.1, windows 10, 8Gb ram), I've 
 had the following output:

 Compiling SKaTERoptimizerD.d...
 Fatal Error: Out of memory
 Building x64\Debug\SKaTERoptimizerD.exe failed!

 When compiled under release (-O -release -inline 
 -boundscheck=off) mode it works fine.

 Any advice on how to combat this? Do I need to start compiling 
 DLLs? Does that change how the linking would be done? Would 
 that affect the debugger?

 Any help is appreciated,
 Matt
My guess would be Optlink, the old OMF linker. Are you using that or the VS linker? Try adding the -v flag to check log output for where it fails.
May 02 2018
parent reply Matt Gamble <gamblemj gmail.com> writes:
On Wednesday, 2 May 2018 at 14:30:19 UTC, Joakim wrote:
 On Wednesday, 2 May 2018 at 14:25:35 UTC, Matt Gamble wrote:
 I have a large program (for me) with several thousand lines of 
 code. Recently when I've tried to compile under debug (-g 
 -unittest)  with VS2017, dmd2.076.1, windows 10, 8Gb ram), 
 I've had the following output:

 Compiling SKaTERoptimizerD.d...
 Fatal Error: Out of memory
 Building x64\Debug\SKaTERoptimizerD.exe failed!

 When compiled under release (-O -release -inline 
 -boundscheck=off) mode it works fine.

 Any advice on how to combat this? Do I need to start compiling 
 DLLs? Does that change how the linking would be done? Would 
 that affect the debugger?

 Any help is appreciated,
 Matt
My guess would be Optlink, the old OMF linker. Are you using that or the VS linker? Try adding the -v flag to check log output for where it fails.
I believe I'm using the vs linker (link.exe). This is what is automatically set for VisualD under x64 mode. I tried the -v flag and got compiler output messages that are 13,758 lines long. The "Fatal Error: Out of memory" happens at line 13,639. How do I use this information?
May 02 2018
parent Joakim <dlang joakim.fea.st> writes:
On Wednesday, 2 May 2018 at 15:13:58 UTC, Matt Gamble wrote:
 On Wednesday, 2 May 2018 at 14:30:19 UTC, Joakim wrote:
 On Wednesday, 2 May 2018 at 14:25:35 UTC, Matt Gamble wrote:
 I have a large program (for me) with several thousand lines 
 of code. Recently when I've tried to compile under debug (-g 
 -unittest)  with VS2017, dmd2.076.1, windows 10, 8Gb ram), 
 I've had the following output:

 Compiling SKaTERoptimizerD.d...
 Fatal Error: Out of memory
 Building x64\Debug\SKaTERoptimizerD.exe failed!

 When compiled under release (-O -release -inline 
 -boundscheck=off) mode it works fine.

 Any advice on how to combat this? Do I need to start 
 compiling DLLs? Does that change how the linking would be 
 done? Would that affect the debugger?

 Any help is appreciated,
 Matt
My guess would be Optlink, the old OMF linker. Are you using that or the VS linker? Try adding the -v flag to check log output for where it fails.
I believe I'm using the vs linker (link.exe). This is what is automatically set for VisualD under x64 mode. I tried the -v flag and got compiler output messages that are 13,758 lines long. The "Fatal Error: Out of memory" happens at line 13,639. How do I use this information?
The idea was to check the log output and see where it's failing, while compiling or linking. It sounds like you're saying while compiling? If so, are you compiling all your D files at once? You can either try separate compilation or a 64-bit compiler, as Rikki suggests.
May 02 2018
prev sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 03/05/2018 2:25 AM, Matt Gamble wrote:
 I have a large program (for me) with several thousand lines of code. 
 Recently when I've tried to compile under debug (-g -unittest)  with 
 VS2017, dmd2.076.1, windows 10, 8Gb ram), I've had the following output:
 
 Compiling SKaTERoptimizerD.d...
 Fatal Error: Out of memory
 Building x64\Debug\SKaTERoptimizerD.exe failed!
 
 When compiled under release (-O -release -inline -boundscheck=off) mode 
 it works fine.
 
 Any advice on how to combat this? Do I need to start compiling DLLs? 
 Does that change how the linking would be done? Would that affect the 
 debugger?
 
 Any help is appreciated,
 Matt
Let me start by saying shared library support doesn't work (some people will say it does work partially, but it doesn't). The problem for you (I think) is that dmd is compiled as a 32bit executable. Either compile dmd as 64bit, or grab ldc (64bit) which will raise the limit from 2gb of ram :)
May 02 2018
parent reply Matt Gamble <gamblemj gmail.com> writes:
On Wednesday, 2 May 2018 at 14:31:16 UTC, rikki cattermole wrote:
 On 03/05/2018 2:25 AM, Matt Gamble wrote:
 [...]
Let me start by saying shared library support doesn't work (some people will say it does work partially, but it doesn't). The problem for you (I think) is that dmd is compiled as a 32bit executable. Either compile dmd as 64bit, or grab ldc (64bit) which will raise the limit from 2gb of ram :)
Thanks, I'll check out Ldc and see if that helps. Will I still be able to use the VS debugger functionality?
May 02 2018
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 03/05/2018 3:21 AM, Matt Gamble wrote:
 On Wednesday, 2 May 2018 at 14:31:16 UTC, rikki cattermole wrote:
 On 03/05/2018 2:25 AM, Matt Gamble wrote:
 [...]
Let me start by saying shared library support doesn't work (some people will say it does work partially, but it doesn't). The problem for you (I think) is that dmd is compiled as a 32bit executable. Either compile dmd as 64bit, or grab ldc (64bit) which will raise the limit from 2gb of ram :)
Thanks, I'll check out Ldc and see if that helps. Will I still be able to use the VS debugger functionality?
Of course.
May 02 2018