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

Function table_set_doesnt_leak

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

Source from the content-addressed store, hash-verified

885#[test]
886#[cfg_attr(miri, ignore)]
887fn table_set_doesnt_leak() -> Result<()> {
888 let _ = env_logger::try_init();
889
890 let mut store = Store::<()>::default();
891 let flag = Arc::new(AtomicBool::new(false));
892
893 {
894 let mut scope = RootScope::new(&mut store);
895 let table = Table::new(
896 &mut scope,
897 TableType::new(RefType::EXTERNREF, 10, Some(10)),
898 Ref::Extern(None),
899 )?;
900
901 let x = ExternRef::new(&mut scope, SetFlagOnDrop(flag.clone()))?;
902 table.set(&mut scope, 2, x.into())?;
903 table.set(&mut scope, 2, x.into())?;
904 table.set(&mut scope, 2, Ref::Extern(None))?;
905 }
906
907 store.gc(None)?;
908 assert!(flag.load(SeqCst));
909 Ok(())
910}
911
912#[test]
913#[cfg_attr(miri, ignore)]

Callers

nothing calls this directly

Calls 7

OkFunction · 0.85
SetFlagOnDropClass · 0.70
newFunction · 0.50
ExternEnum · 0.50
cloneMethod · 0.45
setMethod · 0.45
gcMethod · 0.45

Tested by

no test coverage detected