Skip to content

Implement maximum amount of memory for a container to grow to in WAMR #117

@kr-t

Description

@kr-t

Maximum memory size is allocated in wasm_memory.c on line 1960:

map_size = max_page_count * num_bytes_per_page;

WASM page is 65k, while max_page_count is configurable either via binary compilation with flag: --max-memory=4194304 or with module instantiation during the runtime:

	/* Limit max memory pages to prevent excessive memory allocation with shared memory */
	InstantiationArgs inst_args = {
		.default_stack_size = curr_container_arguments->stack_size,
		.host_managed_heap_size = curr_container_arguments->heap_size,
		.max_memory_pages = 64  /* Limit to 64 pages = 4MB max */
	};

We would like the runtime to be configurable during the runtime, both in shell while creating the container and via API calls.

On Linux systems it's not an issue due to how memory is growing via virtualization, but it's an issue on Zephyr port. We want to be able to run containers which were compiled with unnecessary big --max-memory parameters via runtime configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions