small sisez
authorteodor <teodor>
Thu, 10 Feb 2005 16:36:49 +0000 (16:36 +0000)
committerteodor <teodor>
Thu, 10 Feb 2005 16:36:49 +0000 (16:36 +0000)
memtest.c

index 83097e3..2cb2040 100644 (file)
--- a/memtest.c
+++ b/memtest.c
@@ -46,6 +46,8 @@ usage() {
        exit(1);
 }
 
        exit(1);
 }
 
+#define SZ     32
+
 extern char *optarg;
 extern int opterr;
 
 extern char *optarg;
 extern int opterr;
 
@@ -132,23 +134,23 @@ main(int argn, char *argv[]) {
                        gettimeofday(&begin, NULL);
                        base = allocMemoryContext(NULL, MC_DEBUG);
                        for(i=0;i<count;i++) {
                        gettimeofday(&begin, NULL);
                        base = allocMemoryContext(NULL, MC_DEBUG);
                        for(i=0;i<count;i++) {
-                               ptr = mcalloc(base, 1+random()%1024 );
-                               ptr1 = mcalloc(base, 1+random()%1024 );
+                               ptr = mcalloc(base, 1+random()%SZ );
+                               ptr1 = mcalloc(base, 1+random()%SZ );
                                if ( !(ptr && ptr1) )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = i%256;
                                *ptr1 = i%256;
                                mcfree(ptr1);
 
                                if ( !(ptr && ptr1) )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = i%256;
                                *ptr1 = i%256;
                                mcfree(ptr1);
 
-                               ptr = mcrealloc(ptr, 1+random()%1024 );
+                               ptr = mcrealloc(ptr, 1+random()%SZ );
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+1)%256;
 
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+1)%256;
 
-                               ptr1=mcalloc(base, 1+random()%1024 );
+                               ptr1=mcalloc(base, 1+random()%SZ );
                                *ptr1 = (i+2)%256;
 
                                *ptr1 = (i+2)%256;
 
-                               ptr = mcrealloc(ptr, 1+random()%1024 );
+                               ptr = mcrealloc(ptr, 1+random()%SZ );
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+3)%256;
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+3)%256;
@@ -160,23 +162,23 @@ main(int argn, char *argv[]) {
                } else {
                        gettimeofday(&begin, NULL);
                        for(i=0;i<count;i++) {
                } else {
                        gettimeofday(&begin, NULL);
                        for(i=0;i<count;i++) {
-                               ptr = malloc( 1+random()%1024 );
-                               ptr1 = malloc( 1+random()%1024 );
+                               ptr = malloc( 1+random()%SZ );
+                               ptr1 = malloc( 1+random()%SZ );
                                if ( !(ptr && ptr1) )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = i%256;
                                *ptr1 = i%256;
                                free(ptr1);
 
                                if ( !(ptr && ptr1) )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = i%256;
                                *ptr1 = i%256;
                                free(ptr1);
 
-                               ptr = realloc(ptr, 1+random()%1024 );
+                               ptr = realloc(ptr, 1+random()%SZ );
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+1)%256;
 
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+1)%256;
 
-                               ptr1=malloc( 1+random()%1024 );
+                               ptr1=malloc( 1+random()%SZ );
                                *ptr1 = (i+2)%256;
 
                                *ptr1 = (i+2)%256;
 
-                               ptr = realloc(ptr, 1+random()%1024 );
+                               ptr = realloc(ptr, 1+random()%SZ );
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+3)%256;
                                if ( !ptr )
                                        tlog(TL_CRIT|TL_EXIT,"No memory");
                                *ptr = (i+3)%256;