diff --git a/CHANGELOG.md b/CHANGELOG.md index 74ad5db1bd..231c12ea15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # UNRELEASED +### feat: `dfx canister [create|update-settings] --wasm-memory-threshold` + +This adds support for the WASM memory threshold, used in conjunction with `--wasm-memory-limit`. +When the remaining memory until the limit falls below the threshold, the canister's +`on_low_wasm_memory` handler is run. + ### fix: `dfx deploy --by-proposal` no longer sends chunk data in ProposeCommitBatch Recently we made `dfx deploy` include some chunk data in CommitBatch, in order to streamline diff --git a/docs/dfx-json-schema.json b/docs/dfx-json-schema.json index aa98486369..b49c3a3b6a 100644 --- a/docs/dfx-json-schema.json +++ b/docs/dfx-json-schema.json @@ -447,7 +447,8 @@ "log_visibility": null, "memory_allocation": null, "reserved_cycles_limit": null, - "wasm_memory_limit": null + "wasm_memory_limit": null, + "wasm_memory_threshold": null }, "allOf": [ { @@ -1020,6 +1021,19 @@ "type": "null" } ] + }, + "wasm_memory_threshold": { + "title": "Wasm Memory Threshold", + "description": "Specifies a threshold (in bytes) on the Wasm memory usage of the canister, as a distance from `wasm_memory_limit`.\n\nWhen the remaining memory before the limit drops below this threshold, its `on_low_wasm_memory` hook will be invoked. This enables it to self-optimize, or raise an alert, or otherwise attempt to prevent itself from reaching `wasm_memory_limit`.\n\nMust be a number of bytes between 0 and 2^48 (i.e. 256 TiB), inclusive. Can be specified as an integer, or as an SI unit string (e.g. \"4KB\", \"2 MiB\")", + "default": null, + "anyOf": [ + { + "$ref": "#/definitions/Byte" + }, + { + "type": "null" + } + ] } } },