History

Create configuration struct for VM Add syscall failure exception - Create VM syscall failure message functions Respect the 'r' format verb Create module resolver interface Implement default module resolver interface Implement Sys.fildes() function

arr committed 9 years ago

Commit 232a6591 parent eb06d3d17 files · +416 −124Browse files

Showing the changes to src/vm/vm_memory.cpp (1 of 17 files). Show all

Unified · Split

src/vm/vm_memory.cpp+9−2
@@ -283,7 +283,12 @@ vm_alloc_t::vm_alloc_t(std::shared_ptr<const type_descriptor_t> td) · 282 unmodified lines
283283
284284 vm_alloc_t::~vm_alloc_t()
285285 {
286− assert(_ref_count == 0);
286+#ifndef NDEBUG
287+ if (_ref_count != 0)
288+ debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::warning,
289+ "vm alloc being destroy with non-zero reference count. "
290+ "This could be okay if this is happening due to frame unwinding from an exception");
291+#endif
287292
288293 auto finalizer = alloc_type->finalizer;
289294 if (finalizer != type_descriptor_t::no_finalizer)
@@ -291,7 +296,9 @@ vm_alloc_t::~vm_alloc_t() · 1 unmodified line
291296
292297 // Free pointer types
293298 destroy_memory(*alloc_type, get_allocation());
294− debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm alloc");
299+
300+ if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
301+ debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm alloc");
295302 }
296303
297304 std::size_t vm_alloc_t::add_ref()