Author: Armin Rigo <[email protected]>
Branch: c5
Changeset: r578:d48250c2bf8a
Date: 2013-12-20 17:31 +0100
http://bitbucket.org/pypy/stmgc/changeset/d48250c2bf8a/

Log:    Update demo2.

diff --git a/c5/Makefile b/c5/Makefile
--- a/c5/Makefile
+++ b/c5/Makefile
@@ -6,5 +6,8 @@
 demo1: demo1.c $(C_FILES) $(H_FILES)
        gcc -o $@ -O2 -g demo1.c $(C_FILES) -Wall
 
+demo2: demo2.c largemalloc.c largemalloc.h
+       gcc -o $@ -g demo2.c largemalloc.c -Wall
+
 clean:
-       rm -f demo1
+       rm -f demo1 demo2
diff --git a/c5/demo2.c b/c5/demo2.c
--- a/c5/demo2.c
+++ b/c5/demo2.c
@@ -3,46 +3,48 @@
 #include <assert.h>
 
 
-char *stm_large_malloc(size_t request_size);
-void stm_large_free(char *data);
-void _stm_large_dump(char *data);
+#include "largemalloc.h"
 
-#define dump _stm_large_dump
+#define dump() _stm_large_dump()
+
+
+char buffer[65536];
 
 
 int main()
 {
+    stm_largemalloc_init(buffer, sizeof(buffer));
+
     char *d1 = stm_large_malloc(7000);
-    char *start = d1;
     char *d2 = stm_large_malloc(8000);
-    char *d3 = stm_large_malloc(9000);
+    /*char *d3 = */ stm_large_malloc(9000);
 
-    dump(start);
+    dump();
 
     stm_large_free(d1);
     stm_large_free(d2);
 
-    dump(start);
+    dump();
 
     char *d4 = stm_large_malloc(600);
     assert(d4 == d1);
     char *d5 = stm_large_malloc(600);
     assert(d5 == d4 + 616);
 
-    dump(start);
+    dump();
 
     stm_large_free(d5);
 
-    dump(start);
+    dump();
 
     stm_large_malloc(600);
     stm_large_free(d4);
 
-    dump(start);
+    dump();
 
     stm_large_malloc(608);
 
-    dump(start);
+    dump();
 
     return 0;
 }
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to