Closed usuyuki closed 11 months ago
wasm3側でなく,マイコンにヒープメモリ増やしてといったほうがよいかも? https://qiita.com/nizuki926/items/216bf767b8f0d1dd5dbf
https://docs.platformio.org/en/latest/faq/program-memory-usage.html
PROGRAM (Flash) = .text + .data
DATA (RAM) = .bss + .data
なるほど?
逆にwasmで線形メモリを使わずどうにかできるか? →文字列を含まないようにしてもmemory 2とる.多分wasiがそういう仕組み.
printしてなくてもpanicの文などがwasm内に書き込まれている.
https://github.com/wasm3/wasm3/blob/main/docs/Hardware.md#limited-support
The following devices can run Wasm3, however they cannot afford to allocate even a single Linear Memory page (64KB). This means memoryLimit should be set to the actual amount of RAM available, and that in turn usually breaks the allocator of the hosted Wasm application (which still assumes the page is 64KB and performs OOB access).
なのでwasm3でどうこうするのでなく,そもそもwasmが生成される時点でやる必要がありそう.
wasm3側ではどうにもできないので,frontend-go側にissueを移動する.
理由があってmemory 2にしているものを勝手に変えてもいいの?
PICOのヒープはデフォが0x800=2048byte
wasm2wat tinygo-wasi-memory-limit.wasm -o tinygo-wasi-memory-limit.wat
でtarget.json
{
"inherits": [ "wasi" ],
"ldflags": [
"--initial-memory=65536",
"--max-memory=65536",
"-zstack-size=2048"
]
}
で動かすと
memory 1 1
になった.
小さくできるならなんで最初から小さくないの?
🛠️ 概要
なぜ必要
備考