We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cd5f16 commit 520e2adCopy full SHA for 520e2ad
src/externref.rs
@@ -5,6 +5,7 @@ use std::mem;
5
use std::ptr;
6
use std::slice;
7
use std::vec::Vec;
8
+use std::cmp::max;
9
10
externs! {
11
#[link(wasm_import_module = "__wbindgen_externref_xform__")]
@@ -32,8 +33,9 @@ impl Slab {
32
33
fn alloc(&mut self) -> usize {
34
let ret = self.head;
35
if ret == self.data.len() {
- if self.data.len() == self.data.capacity() {
36
- let extra = 128;
+ let curr_len = self.data.len();
37
+ if curr_len == self.data.capacity() {
38
+ let extra = max(128, curr_len);
39
let r = unsafe { __wbindgen_externref_table_grow(extra) };
40
if r == -1 {
41
internal_error("table grow failure")
0 commit comments