summaryrefslogtreecommitdiff
path: root/test/memleak.awk
blob: 3937658fbdd34dfb1b17716b272327521a9d89b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This program doesn't do anything except allow us to
# check for memory leak from using a user-supplied
# sorting function.
#
# From Andrew Schorr.

function my_func(i1, v1, i2, v2) {
	return v2-v1
}

BEGIN {
	a[1] = "3"
	a[2] = "2"
	a[3] = "4"
	for (i = 0; i < 10000; i++) {
		n = asort(a, b, "my_func")
		s += n
	}
	print s
}