Skip to content

Fix 32-bit build, array size too large - #47

Open
mcprat wants to merge 1 commit into
keys-pub:masterfrom
mcprat:32-bit-build
Open

Fix 32-bit build, array size too large#47
mcprat wants to merge 1 commit into
keys-pub:masterfrom
mcprat:32-bit-build

Conversation

@mcprat

@mcprat mcprat commented Aug 21, 2026

Copy link
Copy Markdown

Building on 32-bit archs causes the following error:

type [1073741824]*_Ctype_char larger than address space

This is because the maximum size limit of the array is 1 GiB, which is equal to an array length 1 << 30 for 1 byte elements. However, for the function goStrings(), the elements in the array are pointers that are 4 bytes long, making it 4 times the limit.

Fix this by reducing the array by the exact difference in bytes so both arrays are now the same total size in 32-bit address space. 1 << 30 / 4 == 1 << (30-2) == 1 << 28

Building on 32-bit archs causes the following error:

    type [1073741824]*_Ctype_char larger than address space

This is because the maximum size limit of the array is 1 GiB,
which is equal to an array length 1 << 30 for 1 byte elements.
However, for the function goStrings(), the elements in the array
are pointers that are 4 bytes long, making it 4 times the limit.

Fix this by reducing the array by the exact difference in bytes
so both arrays are now the same total size in 32-bit address space.
1 << 30 / 4 == 1 << (30-2) == 1 << 28

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant