aboutsummaryrefslogtreecommitdiffstats
path: root/test/memleak.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-04-12 11:45:05 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-04-12 11:45:05 +0300
commit4b68f4ebe7381644e5652a88a5104a10f10f66a7 (patch)
treee242d76e4f41cd63466cf044edcc5868b810ccda /test/memleak.awk
parentbb25148a8e3c8d953f632eb635669abaccedc9a4 (diff)
parent906ac1a525dd0f7ad87bafdaf882323938842760 (diff)
downloadegawk-4b68f4ebe7381644e5652a88a5104a10f10f66a7.tar.gz
egawk-4b68f4ebe7381644e5652a88a5104a10f10f66a7.tar.bz2
egawk-4b68f4ebe7381644e5652a88a5104a10f10f66a7.zip
Merge branch 'master' into feature/api-mpfr
Diffstat (limited to 'test/memleak.awk')
-rw-r--r--test/memleak.awk20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/memleak.awk b/test/memleak.awk
new file mode 100644
index 00000000..3937658f
--- /dev/null
+++ b/test/memleak.awk
@@ -0,0 +1,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
+}