From da5d46cd5db3d890f5458d31227ce121a86f9f67 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Sun, 24 Jan 2021 18:21:20 -0800 Subject: [PATCH] fix: memory access violation --- src/runtime/alloc.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime/alloc.cpp b/src/runtime/alloc.cpp index 05555248e3..48665b3081 100644 --- a/src/runtime/alloc.cpp +++ b/src/runtime/alloc.cpp @@ -390,8 +390,10 @@ extern "C" void * lean_alloc_small(unsigned sz, unsigned slot_idx) { } uint64_t get_num_heartbeats() { - lean_assert(g_heap); - return g_heap->m_heartbeat; + if (g_heap) + return g_heap->m_heartbeat; + else + return 0; } void * alloc(size_t sz) {