A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/WebAssembly/Reference/JavaScript_interface/Memory/grow below:

WebAssembly.Memory.prototype.grow() - WebAssembly | MDN

WebAssembly.Memory.prototype.grow()

Baseline Widely available

grow() は Memory オブジェクトのプロトタイプメソッドで、指定した WebAssembly ページの数だけメモリーインスタンスの大きさを拡張します。

構文 引数
number

メモリーを拡大する WebAssembly ページ数 (それぞれは 64KiB の大きさ)。

返値

以前のメモリーの大きさを、 WebAssembly ページ単位で返します。

例 grow の使用

以下の例では、新しい WebAssembly メモリーインスタンスを初期サイズ 1 ページ (64KiB)、最大サイズ 10 ページ (640KiB) で作成します。

var memory = new WebAssembly.Memory({ initial: 1, maximum: 10 });

それから、インスタンスを 1 ページ分拡張することができます。

const bytesPerPage = 64 * 1024;
console.log(memory.buffer.byteLength / bytesPerPage); // "1"
console.log(memory.grow(1)); // "1"
console.log(memory.buffer.byteLength / bytesPerPage); // "2"

なお、ここでの grow() の返値は直前の WebAssembly ページ数です。

仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4