aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-10-17 05:09:42 +0200
committerMattias Andrée <maandree@operamail.com>2014-10-17 05:09:42 +0200
commit02033888e15519514c7ad2f45d1b4e901e4df8bd (patch)
tree3c0178aba433668cb899c86687f86390d5683a99 /src
parentm gitignore (diff)
downloadmalloc-vs-new-02033888e15519514c7ad2f45d1b4e901e4df8bd.tar.gz
malloc-vs-new-02033888e15519514c7ad2f45d1b4e901e4df8bd.tar.bz2
malloc-vs-new-02033888e15519514c7ad2f45d1b4e901e4df8bd.tar.xz
add alloca
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/alloca.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/alloca.cc b/src/alloca.cc
new file mode 100644
index 0000000..a46c69b
--- /dev/null
+++ b/src/alloca.cc
@@ -0,0 +1,20 @@
+/**
+ * Copying and distribution of this file, with or without modification,
+ * are permitted in any medium without royalty provided the copyright
+ * notice and this notice are preserved. This file is offered as-is,
+ * without any warranty.
+ */
+#include <cstdlib>
+#include <alloca.h>
+
+int main(void)
+{
+ char* a;
+ size_t i;
+
+ for (i = 0; i < 40000000UL; i++)
+ a = (char*)alloca(16);
+
+ return 0;
+}
+