From 378111d767d611c3118391510c9c16a6473be620 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Mon, 7 Oct 2019 17:43:18 +0300 Subject: [PATCH] C: fix generation of heap dump --- .../resources/org/teavm/backend/c/heaptrace.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/core/src/main/resources/org/teavm/backend/c/heaptrace.c b/core/src/main/resources/org/teavm/backend/c/heaptrace.c index 88e886ef6..55ef06937 100644 --- a/core/src/main/resources/org/teavm/backend/c/heaptrace.c +++ b/core/src/main/resources/org/teavm/backend/c/heaptrace.c @@ -321,14 +321,12 @@ void teavm_gc_defragCompleted() { } void teavm_gc_setDumpDirectory(const wchar_t* path) { - #if TEAVM_MEMORY_TRACE - if (teavm_gc_dumpDirectory != NULL) { - free(teavm_gc_dumpDirectory); - } - size_t pathLen = wcslen(path); - size_t bytesLen = sizeof(wchar_t) * (pathLen + 1); - teavm_gc_dumpDirectory = malloc(bytesLen); - memcpy(teavm_gc_dumpDirectory, path, bytesLen); - #endif + if (teavm_gc_dumpDirectory != NULL) { + free(teavm_gc_dumpDirectory); + } + size_t pathLen = wcslen(path); + size_t bytesLen = sizeof(wchar_t) * (pathLen + 1); + teavm_gc_dumpDirectory = malloc(bytesLen); + memcpy(teavm_gc_dumpDirectory, path, bytesLen); }