File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -95,4 +95,27 @@ mod tests {
9595 assert ! ( limits. table_growing( 9 , 10 , None ) . await . unwrap( ) ) ;
9696 assert ! ( !limits. table_growing( 10 , 11 , None ) . await . unwrap( ) ) ;
9797 }
98+
99+ #[ tokio:: test]
100+ async fn test_memory_consumed ( ) {
101+ let engine = wasmtime:: Engine :: new ( crate :: Config :: default ( ) . wasmtime_config ( ) ) . unwrap ( ) ;
102+ let linker = wasmtime:: component:: Linker :: new ( & engine) ;
103+ let component = wasmtime:: component:: Component :: new (
104+ & engine,
105+ r#"
106+ (component
107+ (core module $m (memory 1))
108+ (core instance $a (instantiate $m))
109+ )
110+ "# ,
111+ )
112+ . unwrap ( ) ;
113+ let mut store = wasmtime:: Store :: new ( & engine, StoreLimitsAsync :: default ( ) ) ;
114+ store. limiter_async ( |s| s) ;
115+ let _ = linker
116+ . instantiate_async ( & mut store, & component)
117+ . await
118+ . unwrap ( ) ;
119+ assert_eq ! ( store. data( ) . memory_consumed( ) , 1 << 16 ) ;
120+ }
98121}
You can’t perform that action at this time.
0 commit comments