Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

mbig.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 
00005 int main( int argc , char * argv[] )
00006 {
00007    int mm,ii ;
00008    char * cc ;
00009 
00010    if( argc < 2 || strcmp(argv[1],"-help")==0 ){
00011       printf("Usage: mbig n\n"
00012              "Will allocate n Megabytes of memory, then quit.\n") ;
00013       exit(0) ;
00014    }
00015 
00016    mm = strtol( argv[1] , NULL , 10 ) ;
00017    if( mm <= 0 ) exit(1) ;
00018 
00019    cc = (char *)malloc( mm*1024*1024 * sizeof(char) ) ;
00020    printf("Malloc-ed %d Megabytes",mm) ; fflush(stdout) ;
00021    for( ii=0 ; ii < mm*1024*1024 ; ii++ ) cc[ii] = (char) (ii%128) ;
00022 
00023    for( ii=0 ; ii < 3 ; ii++ ){
00024       sleep(1) ; printf(".") ; fflush(stdout) ;
00025    }
00026    printf("\n") ; exit(0) ;
00027 }
 

Powered by Plone

This site conforms to the following standards: