@@ -258,6 +258,12 @@ WASM_DEFINE_VEC_OWN(module, wasm_module_delete_internal)
258258WASM_DEFINE_VEC_OWN (store , wasm_store_delete )
259259WASM_DEFINE_VEC_OWN (valtype , wasm_valtype_delete )
260260
261+ #ifndef NDEBUG
262+ #define WASM_C_DUMP_PROC_MEM () LOG_PROC_MEM ()
263+ #else
264+ #define WASM_C_DUMP_PROC_MEM () (void )0
265+ #endif
266+
261267/* Runtime Environment */
262268own wasm_config_t *
263269wasm_config_new (void )
@@ -307,6 +313,14 @@ wasm_engine_new_internal(mem_alloc_type_t type, const MemAllocOption *opts)
307313 RuntimeInitArgs init_args = { 0 };
308314 init_args .mem_alloc_type = type ;
309315
316+ #ifndef NDEBUG
317+ bh_log_set_verbose_level (BH_LOG_LEVEL_VERBOSE );
318+ #else
319+ bh_log_set_verbose_level (BH_LOG_LEVEL_WARNING );
320+ #endif
321+
322+ WASM_C_DUMP_PROC_MEM ();
323+
310324 if (type == Alloc_With_Pool ) {
311325 if (!opts ) {
312326 return NULL ;
@@ -337,14 +351,6 @@ wasm_engine_new_internal(mem_alloc_type_t type, const MemAllocOption *opts)
337351 goto failed ;
338352 }
339353
340- #ifndef NDEBUG
341- /*DEBUG*/
342- bh_log_set_verbose_level (BH_LOG_LEVEL_VERBOSE );
343- #else
344- /*VERBOSE*/
345- bh_log_set_verbose_level (BH_LOG_LEVEL_WARNING );
346- #endif
347-
348354 /* create wasm_engine_t */
349355 if (!(engine = malloc_internal (sizeof (wasm_engine_t )))) {
350356 goto failed ;
@@ -358,6 +364,8 @@ wasm_engine_new_internal(mem_alloc_type_t type, const MemAllocOption *opts)
358364
359365 engine -> ref_count = 1 ;
360366
367+ WASM_C_DUMP_PROC_MEM ();
368+
361369 RETURN_OBJ (engine , wasm_engine_delete_internal )
362370}
363371
@@ -442,6 +450,8 @@ wasm_store_new(wasm_engine_t *engine)
442450{
443451 wasm_store_t * store = NULL ;
444452
453+ WASM_C_DUMP_PROC_MEM ();
454+
445455 if (!engine || singleton_engine != engine ) {
446456 return NULL ;
447457 }
@@ -474,6 +484,8 @@ wasm_store_new(wasm_engine_t *engine)
474484 goto failed ;
475485 }
476486
487+ WASM_C_DUMP_PROC_MEM ();
488+
477489 return store ;
478490failed :
479491 wasm_store_delete (store );
@@ -1903,6 +1915,8 @@ wasm_module_new(wasm_store_t *store, const wasm_byte_vec_t *binary)
19031915
19041916 bh_assert (singleton_engine );
19051917
1918+ WASM_C_DUMP_PROC_MEM ();
1919+
19061920 if (!store || !binary || binary -> size == 0 || binary -> size > UINT32_MAX )
19071921 goto quit ;
19081922
@@ -1958,6 +1972,9 @@ wasm_module_new(wasm_store_t *store, const wasm_byte_vec_t *binary)
19581972 goto destroy_lock ;
19591973
19601974 module_ex -> ref_count = 1 ;
1975+
1976+ WASM_C_DUMP_PROC_MEM ();
1977+
19611978 return module_ext_to_module (module_ex );
19621979
19631980destroy_lock :
@@ -4453,6 +4470,8 @@ wasm_instance_new_with_args(wasm_store_t *store, const wasm_module_t *module,
44534470 return NULL ;
44544471 }
44554472
4473+ WASM_C_DUMP_PROC_MEM ();
4474+
44564475 instance = malloc_internal (sizeof (wasm_instance_t ));
44574476 if (!instance ) {
44584477 goto failed ;
@@ -4595,6 +4614,8 @@ wasm_instance_new_with_args(wasm_store_t *store, const wasm_module_t *module,
45954614 goto failed ;
45964615 }
45974616
4617+ WASM_C_DUMP_PROC_MEM ();
4618+
45984619 return instance ;
45994620
46004621failed :
0 commit comments