Re: Memory allocation failed in CT

2019-07-13 Thread a11e99z via Digitalmars-d-learn

On Saturday, 13 July 2019 at 06:25:37 UTC, Andrey wrote:

On Tuesday, 9 July 2019 at 19:04:53 UTC, Max Haughton wrote:
Is this a 64 or 32 bit compiler? Also could you post the 
source code if possible?


You could try "--DRT-gcopt=profile:1" druntime flag to see if 
the compiler is running out of memory for real


Thanks for help. I solved my issue by rewritting code.


can u describe how u rewrote the code?
so it can be solution for all of us:
when u generate long string in CT for mixins and u get an 
exception u can do next ...


Re: Memory allocation failed in CT

2019-07-13 Thread Andrey via Digitalmars-d-learn

On Tuesday, 9 July 2019 at 19:04:53 UTC, Max Haughton wrote:
Is this a 64 or 32 bit compiler? Also could you post the source 
code if possible?


You could try "--DRT-gcopt=profile:1" druntime flag to see if 
the compiler is running out of memory for real


Thanks for help. I solved my issue by rewritting code.


Re: Memory allocation failed in CT

2019-07-09 Thread Max Haughton via Digitalmars-d-learn
Is this a 64 or 32 bit compiler? Also could you post the source 
code if possible?


You could try "--DRT-gcopt=profile:1" druntime flag to see if the 
compiler is running out of memory for real


Re: Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn

On Tuesday, 9 July 2019 at 17:59:24 UTC, Max Haughton wrote:

On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote:

Hello,
I have got a problem with compile-time calulations.
I have some code generator that should create some long string 
of code during CT and after generation I mixin it. If I run it 
normally - in run time - then there is no error and I get 
expected output - string with size ~ 3.5 MB.

If I run it in CT then I recieve an error:

[...]


I don't understand why...
The only operation in my generator is string concatination: 
_result ~= "some code...".


Are you using the -lowmem flag? This enables the GC during 
compilation i.e. you might be running out of memory (CTFE is 
not efficient with memory during evaluation)


I tried to turn on this flag but no success. The same error...


Re: Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn

On Tuesday, 9 July 2019 at 17:59:24 UTC, Max Haughton wrote:

On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote:


I in addition wrote "buffer.reserve(10 * 1014 * 1024);" and it 
also doesn't help.


Re: Memory allocation failed in CT

2019-07-09 Thread Max Haughton via Digitalmars-d-learn

On Tuesday, 9 July 2019 at 17:48:52 UTC, Andrey wrote:

Hello,
I have got a problem with compile-time calulations.
I have some code generator that should create some long string 
of code during CT and after generation I mixin it. If I run it 
normally - in run time - then there is no error and I get 
expected output - string with size ~ 3.5 MB.

If I run it in CT then I recieve an error:

[...]


I don't understand why...
The only operation in my generator is string concatination: 
_result ~= "some code...".


Are you using the -lowmem flag? This enables the GC during 
compilation i.e. you might be running out of memory (CTFE is not 
efficient with memory during evaluation)


Memory allocation failed in CT

2019-07-09 Thread Andrey via Digitalmars-d-learn

Hello,
I have got a problem with compile-time calulations.
I have some code generator that should create some long string of 
code during CT and after generation I mixin it. If I run it 
normally - in run time - then there is no error and I get 
expected output - string with size ~ 3.5 MB.

If I run it in CT then I recieve an error:
core.exception.OutOfMemoryError@core\exception.d(702): Memory 
allocation failed


0x7FF65A80BE73
0x7FF65A80BE73
0x7FF65A80BB46
0x7FF65A7FBA5C
0x7FF65A8035EC
0x7FF65A804311
0x7FF658BA733E
0x7FF658CC561F
0x7FF658CC0CD8
0x7FF658CB3728
0x7FF658CB3826
0x7FF658CB4762
0x7FF658CB3826
0x7FF658CB3CD0
E:\Programs\LDC2\bin\ldc2.exe failed with exit code 1.


I don't understand why...
The only operation in my generator is string concatination: 
_result ~= "some code...".