Skip to content

[wasm-ld] How to specify a non-growable memory without --initial-memory and --max-memory #81932

Closed
@sbc100

Description

@sbc100

Until recently the way to specify a non-growable memory was to specify both --initial-memory and --max-memory and set them to the same value. This is what emscripten currently does by default unless you opt into -sALLOW_MEMORY_GROWTH.

However, we recently added a new --initial-heap flag which allows the user to set and initial heap size and have the linker then derive the initial memory size based on the sum of stack size + heap size + static data size. See #75594.

When attempting to start using this flag in emscripten we discovered that there is no way to use the --initial-heap flag and still get a non-growable memory. See https://github.com/emscripten-core/emscripten/pull/21071/files#r1491731562.

It seems that we need some kind of flag like the existing --growable-table flag. It would be nice to add --growable-memory except that would mean changing the default to non-growable, which is perhaps too much of a breaking change. @sunfishcode WDYT?

Instead perhaps we can add --no-growable-memory?

Perhaps the existing --growable-table flag could also take a no- prefix so that they were symmetrical?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions