Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max total size of static arrays #3997

Open
dlangBugzillaToGithub opened this issue Mar 23, 2023 · 0 comments
Open

max total size of static arrays #3997

dlangBugzillaToGithub opened this issue Mar 23, 2023 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

kdevel reported this on 2023-03-23T13:26:58Z

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

Description

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant