Add test binary to verify that this trick also works with pure C applications
authorMilian Wolff <mail@milianw.de>
Fri, 31 May 2013 12:18:49 +0000 (14:18 +0200)
committerMilian Wolff <mail@milianw.de>
Fri, 31 May 2013 12:18:49 +0000 (14:18 +0200)
CMakeLists.txt
test.c [new file with mode: 0644]

index 9867bee..ba47753 100644 (file)
@@ -9,4 +9,6 @@ add_definitions("-std=c++11")
 add_executable(mallocinfo main.cpp)
 target_link_libraries(mallocinfo dumpmallocinfo)
 
+add_executable(test_c test.c)
+
 install(TARGETS mallocinfo RUNTIME DESTINATION bin)
diff --git a/test.c b/test.c
new file mode 100644 (file)
index 0000000..bcc93e6
--- /dev/null
+++ b/test.c
@@ -0,0 +1,14 @@
+#include <unistd.h>
+#include <stdlib.h>
+
+int main()
+{
+    int i;
+    // make app deterministic
+    srand(0);
+    for (i = 0; i < 10000; ++i) {
+        malloc(rand() % 1000);
+        usleep(100);
+    }
+    return 0;
+}
\ No newline at end of file