aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-10-17 02:51:11 +0200
committerMattias Andrée <maandree@operamail.com>2014-10-17 02:51:11 +0200
commit7de3ef26370a5822c387e449e6fbfc1c9d083591 (patch)
treee1a6f85f132e7788540fd8ea83e98de4d24d323f
downloadmalloc-vs-new-7de3ef26370a5822c387e449e6fbfc1c9d083591.tar.gz
malloc-vs-new-7de3ef26370a5822c387e449e6fbfc1c9d083591.tar.bz2
malloc-vs-new-7de3ef26370a5822c387e449e6fbfc1c9d083591.tar.xz
first commit
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--.gitignore15
-rw-r--r--COPYING5
-rw-r--r--Makefile18
-rw-r--r--src/malloc.cc19
-rw-r--r--src/new.cc19
5 files changed, 76 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1538152
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+_/
+bin/
+obj/
+\#*\#
+.*
+!.git*
+*~
+*.bak
+*.swo
+*.swp
+*.o
+*.out
+*.su
+*.gch
+
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..7fd7747
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,5 @@
+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.
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..ec57bed
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,18 @@
+# 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.
+
+
+.PHONY: all
+all: bin/malloc bin/new
+
+
+bin/%: src/%.cc
+ @mkdir -p bin
+ $(CXX) -O0 -o $@ $^
+
+.PHONY: clean
+clean:
+ -rm -r bin
+
diff --git a/src/malloc.cc b/src/malloc.cc
new file mode 100644
index 0000000..22b4cdb
--- /dev/null
+++ b/src/malloc.cc
@@ -0,0 +1,19 @@
+/**
+ * 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>
+
+int main(void)
+{
+ char* a;
+ size_t i;
+
+ for (i = 0; i < 40000000UL; i++)
+ a = (char*)malloc(16);
+
+ return 0;
+}
+
diff --git a/src/new.cc b/src/new.cc
new file mode 100644
index 0000000..5e96747
--- /dev/null
+++ b/src/new.cc
@@ -0,0 +1,19 @@
+/**
+ * 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>
+
+int main(void)
+{
+ char* a;
+ size_t i;
+
+ for (i = 0; i < 40000000UL; i++)
+ a = new char[16];
+
+ return 0;
+}
+