Commit a57caa3
authored
fix: prevent WASM out-of-bounds trap in concurrent generate calls (#111)
When multiple `icpBindgen` plugin instances run concurrently (e.g.
several `.did` files processed during Vite's `buildStart`), the WASM
`GenerateResul`t object could be held across await boundaries in
`writeBindings()`. This was observed to cause intermittent `"Out of
bounds memory access"` traps on the `service_ts` getter.
Extract all strings from the WASM object synchronously immediately after
`wasmGenerate()` and free it explicitly, so that `writeBindings`
operates only on plain JS strings.
Ref: #1091 parent c7bc48a commit a57caa3
1 file changed
+24
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
125 | 139 | | |
126 | | - | |
| 140 | + | |
127 | 141 | | |
128 | 142 | | |
129 | 143 | | |
130 | 144 | | |
131 | 145 | | |
132 | 146 | | |
133 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
134 | 155 | | |
135 | | - | |
| 156 | + | |
136 | 157 | | |
137 | 158 | | |
138 | 159 | | |
| |||
0 commit comments