summary refs log tree commit diff stats
path: root/tests/destructor/tgotoexc_leak.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/destructor/tgotoexc_leak.nim')
-rw-r--r--tests/destructor/tgotoexc_leak.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/destructor/tgotoexc_leak.nim b/tests/destructor/tgotoexc_leak.nim
new file mode 100644
index 000000000..c8a234085
--- /dev/null
+++ b/tests/destructor/tgotoexc_leak.nim
@@ -0,0 +1,19 @@
+discard """
+  output: '''0
+true'''
+  cmd: "nim c --gc:arc $file"
+"""
+
+# bug #22398
+
+for i in 0 ..< 10_000:
+  try:
+    try:
+      raise newException(ValueError, "")
+    except CatchableError:
+      discard
+      raise newException(ValueError, "") # or raise getCurrentException(), just raise works ok
+  except ValueError:
+    discard
+echo getOccupiedMem()
+echo getCurrentException() == nil
800 committer Kartik K. Agaram <vc@akkartik.com> 2017-12-03 23:25:40 -0800 4134 - 'input' = 'ingredient'' href='/akkartik/mu/commit/nqueens.mu?h=main&id=4a48bedcd1d708a43d43dc6259a4e45c52ea3d00'>4a48bedc ^
2f02189d ^
192d59d3 ^
7890b8ce ^
9458918f ^
7890b8ce ^




192d59d3 ^
7890b8ce ^


192d59d3 ^
7890b8ce ^


192d59d3 ^
7890b8ce ^
9458918f ^
7890b8ce ^


9458918f ^
7890b8ce ^
c0d61295 ^

7890b8ce ^






947c639e ^



9458918f ^
7890b8ce ^
4a48bedc ^
40923720 ^
4f1d1944 ^
40923720 ^
7890b8ce ^

9458918f ^
7890b8ce ^
4a48bedc ^
192d59d3 ^
7890b8ce ^


192d59d3 ^
9458918f ^
dd660682 ^
7890b8ce ^


dd660682 ^
7890b8ce ^

9458918f ^
7890b8ce ^
4a48bedc ^
192d59d3 ^

7890b8ce ^


192d59d3 ^



7890b8ce ^

9458918f ^
dd660682 ^
7890b8ce ^


dd660682 ^
7890b8ce ^
760f683f ^




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101