Debian Codegraph @

test/memleak.awk

raw
1 # This program doesn't do anything except allow us to
2 # check for memory leak from using a user-supplied
3 # sorting function.
4 #
5 # From Andrew Schorr.
6
7 function my_func(i1, v1, i2, v2) {
8 return v2-v1
9 }
10
11 BEGIN {
12 a[1] = "3"
13 a[2] = "2"
14 a[3] = "4"
15 for (i = 0; i < 10000; i++) {
16 n = asort(a, b, "my_func")
17 s += n
18 }
19 print s
20 }