Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/heap.cfa

    r80228a7 r200fcb3  
    1010// Created On       : Tue Nov  6 17:54:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov  8 09:03:54 2018
    13 // Update Count     : 17
     12// Last Modified On : Tue Dec 11 21:52:40 2018
     13// Update Count     : 18
    1414//
    1515
     
    4545                for ( i; NoOfAllocs ) {
    4646                        locns[i] = alloc( i );
    47                         //sout | (void *)locns[i] | endl;
     47                        //sout | (void *)locns[i];
    4848                        for ( k; i ) locns[i][k] = '\345';
    4949                } // for
    50                 //sout | (char *)sbrk(0) - start | " bytes" | endl;
     50                //sout | (char *)sbrk(0) - start | " bytes";
    5151
    5252                for ( i; NoOfAllocs ) {
    53                         //sout | (void *)locns[i] | endl;
     53                        //sout | (void *)locns[i];
    5454                        for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage1" );
    5555                        free( locns[i] );
    5656                } // for
    57                 //sout | (char *)sbrk(0) - start | " bytes" | endl;
     57                //sout | (char *)sbrk(0) - start | " bytes";
    5858
    5959                for ( i; NoOfAllocs ) {
    6060                        locns[i] = alloc( i );
    61                         //sout | (void *)locns[i] | endl;
     61                        //sout | (void *)locns[i];
    6262                        for ( k; i ) locns[i][k] = '\345';
    6363                } // for
    6464                for ( i; NoOfAllocs - 1 -~= 0 ) {
    65                         //sout | (void *)locns[i] | endl;
     65                        //sout | (void *)locns[i];
    6666                        for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage2" );
    6767                        free( locns[i] );
     
    186186
    187187        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    188                 //sout | alignments[a] | endl;
     188                //sout | alignments[a];
    189189                for ( s; 1 ~ NoOfAllocs ) {                                             // allocation of size 0 can return null
    190190                        char * area = (char *)memalign( a, s );
    191191                        if ( area == 0 ) abort( "memalign/free out of memory" );
    192                         //sout | i | " " | area | endl;
     192                        //sout | i | " " | area;
    193193                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    194194                                abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, s, area );
     
    203203
    204204        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    205                 //sout | alignments[a] | endl;
     205                //sout | alignments[a];
    206206                for ( i; 1 ~ NoOfMmaps ) {
    207207                        size_t s = i + default_mmap_start();            // cross over point
    208208                        char * area = (char *)memalign( a, s );
    209209                        if ( area == 0 ) abort( "memalign/free out of memory" );
    210                         //sout | i | " " | area | endl;
     210                        //sout | i | " " | area;
    211211                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    212212                                abort( "memalign/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)s, area );
     
    268268                char * area = (char *)memalign( a, amount );    // aligned N-byte allocation
    269269                if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    270                 //sout | alignments[a] | " " | area | endl;
     270                //sout | alignments[a] | " " | area;
    271271                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    272272                        abort( "memalign/realloc/free bad alignment : memalign(%d,%d) = %p", (int)a, (int)amount, area );
     
    279279                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    280280                        if ( area == 0 ) abort( "memalign/realloc/free out of memory" ); // no storage ?
    281                         //sout | i | " " | area | endl;
     281                        //sout | i | " " | area;
    282282                        if ( (size_t)area % a != 0 ) {                          // check for initial alignment
    283283                                abort( "memalign/realloc/free bad alignment %p", area );
     
    291291
    292292        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    293                 //sout | alignments[a] | endl;
     293                //sout | alignments[a];
    294294                for ( s; 1 ~ limit ) {                                                  // allocation of size 0 can return null
    295295                        char * area = (char *)cmemalign( a, 1, s );
    296296                        if ( area == 0 ) abort( "cmemalign/free out of memory" );
    297                         //sout | i | " " | area | endl;
     297                        //sout | i | " " | area;
    298298                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    299299                                abort( "cmemalign/free bad alignment : cmemalign(%d,%d) = %p", (int)a, s, area );
     
    314314                char * area = (char *)cmemalign( a, 1, amount ); // aligned N-byte allocation
    315315                if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    316                 //sout | alignments[a] | " " | area | endl;
     316                //sout | alignments[a] | " " | area;
    317317                if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    318318                        abort( "cmemalign/realloc/free bad alignment : cmemalign(%d,%d) = %p", (int)a, (int)amount, area );
     
    328328                        area = (char *)realloc( area, s );                      // attempt to reuse storage
    329329                        if ( area == 0 ) abort( "cmemalign/realloc/free out of memory" ); // no storage ?
    330                         //sout | i | " " | area | endl;
     330                        //sout | i | " " | area;
    331331                        if ( (size_t)area % a != 0 || malloc_alignment( area ) != a ) { // check for initial alignment
    332332                                abort( "cmemalign/realloc/free bad alignment %p", area );
     
    339339                free( area );
    340340    } // for
    341         //sout | "worker" | thisTask() | "successful completion" | endl;
     341        //sout | "worker" | thisTask() | "successful completion";
    342342} // Worker main
    343343
Note: See TracChangeset for help on using the changeset viewer.