summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2019-01-30 00:26:33 -0800
committerAndreas Rumpf <rumpf_a@web.de>2019-01-30 09:26:33 +0100
commite98bd3acebb21b14894e7f12c0b7f9e79a3f4c9c (patch)
tree5110e72c08f407012193a3df18a8824175b383a8 /lib/system
parentb2a5195e92f8852a47ca70136b103bc374b73393 (diff)
downloadNim-e98bd3acebb21b14894e7f12c0b7f9e79a3f4c9c.tar.gz
fix #10488 GC memory leak regression (#10498)
* fix #10488 GC memory leak regression

* re-enable gch.stack.bottom.repr but only inside when defined(logGC)
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/gc.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index 416827f21..018197c1e 100644
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -864,7 +864,10 @@ when not defined(useNimRtl):
       for stack in items(gch.stack):
         result.add "[GC]   stack " & stack.bottom.repr & "[GC]     max stack size " & cast[pointer](stack.maxStackSize).repr & "\n"
     else:
-      result.add "[GC] stack bottom: " & gch.stack.bottom.repr
+      # this caused memory leaks, see #10488 ; find a way without `repr`
+      # maybe using a local copy of strutils.toHex or snprintf
+      when defined(logGC):
+        result.add "[GC] stack bottom: " & gch.stack.bottom.repr
       result.add "[GC] max stack size: " & $gch.stat.maxStackSize & "\n"
 
 {.pop.} # profiler: off, stackTrace: off