()
| 943 | #[test] |
| 944 | #[cfg_attr(miri, ignore)] |
| 945 | fn table_init_doesnt_leak() -> Result<()> { |
| 946 | const SIZE: u64 = 64 << 10; |
| 947 | |
| 948 | let _ = env_logger::try_init(); |
| 949 | |
| 950 | let mut config = Config::new(); |
| 951 | config.wasm_gc(true); |
| 952 | config.wasm_function_references(true); |
| 953 | config.memory_may_move(false); |
| 954 | config.memory_reservation(SIZE); |
| 955 | config.memory_reservation_for_growth(0); |
| 956 | let engine = Engine::new(&config)?; |
| 957 | let mut store = Store::new(&engine, ()); |
| 958 | |
| 959 | let module = Module::new( |
| 960 | store.engine(), |
| 961 | r#" |
| 962 | (module |
| 963 | (table 1 arrayref) |
| 964 | |
| 965 | (type $a (array i31ref)) |
| 966 | |
| 967 | (func (export "run") |
| 968 | i32.const 0 |
| 969 | i32.const 0 |
| 970 | i32.const 1 |
| 971 | table.init $e) |
| 972 | (elem $e arrayref (array.new $a (ref.i31 (i32.const 0)) (i32.const 200))) |
| 973 | ) |
| 974 | "#, |
| 975 | )?; |
| 976 | |
| 977 | let instance = Instance::new(&mut store, &module, &[])?; |
| 978 | let func = instance.get_typed_func::<(), ()>(&mut store, "run")?; |
| 979 | for _ in 0..200 { |
| 980 | func.call(&mut store, ())?; |
| 981 | } |
| 982 | |
| 983 | Ok(()) |
| 984 | } |
| 985 | |
| 986 | #[test] |
| 987 | fn ref_matches() -> Result<()> { |
nothing calls this directly
no test coverage detected