blob: 66b0aec303435dda3b590be30bf34ccecbcc0e66 (
plain) (
blame)
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
|
discard """
valgrind: true
cmd: '''nim c -d:nimAllocStats --newruntime $file'''
output: '''OK 3
(allocCount: 7, deallocCount: 4)'''
"""
import strutils, math
import system / ansi_c
proc mainA =
try:
var e: owned(ref ValueError)
new(e)
e.msg = "message"
raise e
except Exception as e:
raise
proc main =
raise newException(ValueError, "argh")
var ok = 0
try:
mainA()
except ValueError:
inc ok
except:
discard
try:
main()
except ValueError:
inc ok
except:
discard
# bug #11577
proc newError*: owned(ref Exception) {.noinline.} =
new(result)
proc mainC =
raise newError()
try:
mainC()
except:
inc ok
echo "OK ", ok
echo getAllocStats()
|