[Issue 23804] New: max total size of static arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 23 13:26:58 UTC 2023


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

          Issue ID: 23804
           Summary: max total size of static arrays
           Product: D
           Version: D2
          Hardware: Other
                OS: Other
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: kdevel at vogtner.de

https://dlang.org/spec/arrays.html

"2. The total size of a static array cannot exceed 16Mb"

Radio Yerevan was asked: "Is it true that in D static arrays cannot exceed
16Mb?"

Radio Yerevan answered: "In principle, yes. But it is not megabits (Mb) but
mebibytes (MiB). Furthermore the maximum size of static arrays is int.max bytes
(2,147,483,647 B = 2 GiB - 1 B) except for Windows where it is 16 MiB."

diff --git a/compiler/src/dmd/target.d b/compiler/src/dmd/target.d
index 461e1e9..a3ab681 100644
--- a/compiler/src/dmd/target.d
+++ b/compiler/src/dmd/target.d
@@ -262,9 +262,9 @@ extern (C++) struct Target
             if (ptrsize == 4)
             {
                 /* Optlink cannot deal with individual data chunks
-                 * larger than 16Mb
+                 * larger than 16 MiB
                  */
-                maxStaticDataSize = 0x100_0000;  // 16Mb
+                maxStaticDataSize = 0x100_0000;  // 16 MiB
             }
         }
         else

--


More information about the Digitalmars-d-bugs mailing list