MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / table_init_doesnt_leak

Function table_init_doesnt_leak

tests/all/gc.rs:945–984  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

943#[test]
944#[cfg_attr(miri, ignore)]
945fn 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]
987fn ref_matches() -> Result<()> {

Callers

nothing calls this directly

Calls 9

OkFunction · 0.85
newFunction · 0.50
wasm_gcMethod · 0.45
memory_may_moveMethod · 0.45
memory_reservationMethod · 0.45
engineMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected