[Issue 23603] ICE out of memory when using -lowmem

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 11 21:03:14 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23603

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|---                         |WONTFIX

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
Issues:

1. `import std` imports all of Phobos. This is quite impractical, and import by
package should never have been added. It will always make compiling desperately
slow and will consume vast quantities of memory.

Recommendation: just import modules that are needed

2. The declaration of `data` has an initialization that must happen at compile
time. The CTFE to do it does not store expressions efficiently - the array is
stored as (256 * 131,070) Expression AST nodes. This is going to consume a lot
of memory, and will also be extremely slow. Then, it will have to generate (256
* 131,070) static initializers.

Recommendation: Replace with a pointer initialized at runtime:

    Array!A(255)* pdata;
    static this() { pdata = new Array!(255); }

which will push that all off to runtime, where it is efficiently handled.

This should resolve the slow compiles, vast compile time memory consumption,
and large executable file size problems. I don't see any reasonable way to fix
this in the language.

--


More information about the Digitalmars-d-bugs mailing list