Ticket #783: leak.pir

File leak.pir, 0.6 KB (added by coke, 5 years ago)

anonymous sub memory leak

Line 
1.sub main :main
2 .local pmc pir
3 pir = compreg 'PIR'
4 .include 'interpinfo.pasm'
5
6 .local int counter, modulo, memory, every
7 counter = 0
8 every = 50000
9
10 .local string src
11loop:
12 inc counter
13
14src = <<"END_PIR"
15.sub foo :anon
16  noop
17.end
18END_PIR
19
20   .local pmc anon
21   anon = pir(src)
22   anon()
23   null anon
24
25   modulo = counter % every
26   if modulo goto loop
27
28   printerr counter
29   printerr " iterations\n"
30   memory = interpinfo .INTERPINFO_TOTAL_MEM_ALLOC
31   printerr "  TOTAL_MEM_ALLOC............: "
32   printerr memory
33   printerr "\n"
34
35goto loop
36done:
37
38.end