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

Function table_copy_doesnt_leak

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

Source from the content-addressed store, hash-verified

858#[test]
859#[cfg_attr(miri, ignore)]
860fn table_copy_doesnt_leak() -> Result<()> {
861 let _ = env_logger::try_init();
862
863 let mut store = Store::<()>::default();
864 let flag = Arc::new(AtomicBool::new(false));
865
866 {
867 let mut scope = RootScope::new(&mut store);
868 let table = Table::new(
869 &mut scope,
870 TableType::new(RefType::EXTERNREF, 10, Some(10)),
871 Ref::Extern(None),
872 )?;
873
874 let x = ExternRef::new(&mut scope, SetFlagOnDrop(flag.clone()))?;
875 table.fill(&mut scope, 2, x.into(), 3)?;
876
877 Table::copy(&mut scope, &table, 0, &table, 5, 5)?;
878 }
879
880 store.gc(None)?;
881 assert!(flag.load(SeqCst));
882 Ok(())
883}
884
885#[test]
886#[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
fillMethod · 0.45
gcMethod · 0.45

Tested by

no test coverage detected