Changeset 4962741
- Timestamp:
- Aug 10, 2022, 11:05:44 AM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- ccbc65c, dbedd71
- Parents:
- ff36907
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/heap.cfa
rff36907 r4962741 10 10 // Created On : Tue Nov 6 17:54:56 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 15 12:11:51 202013 // Update Count : 7912 // Last Modified On : Wed Aug 10 09:57:01 2022 13 // Update Count : 86 14 14 // 15 15 … … 26 26 // return __CFA_DEFAULT_PREEMPTION__; 27 27 // } 28 29 size_t default_heap_expansion() {30 return 10 * 1024 * 1024;31 } // default_heap_expansion32 33 size_t default_mmap_start() {34 return 512 * 1024 + 1;35 } // default_mmap_start36 28 37 29 thread Worker { … … 66 58 for ( k; i ) locns[i][k] = '\345'; 67 59 } // for 68 for ( i; NoOfAllocs - 1 -~= 0) {60 for ( i; -~= NoOfAllocs - 1 ) { 69 61 //sout | (void *)locns[i]; 70 62 for ( k; i ) if ( locns[i][k] != '\345' ) abort( "new/delete corrupt storage2" ); … … 99 91 100 92 for ( i; NoOfMmaps ) { 101 size_t s = i + default_mmap_start(); // cross over point93 size_t s = i + malloc_mmap_start(); // cross over point 102 94 char * area = (char *)malloc( s ); 103 95 area[0] = '\345'; area[s - 1] = '\345'; // fill first/last … … 107 99 108 100 for ( i; NoOfMmaps ) { 109 size_t s = i + default_mmap_start(); // cross over point101 size_t s = i + malloc_mmap_start(); // cross over point 110 102 locns[i] = (char *)malloc( s ); 111 103 locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last … … 113 105 } // for 114 106 for ( i; NoOfMmaps ) { 115 size_t s = i + default_mmap_start(); // cross over point107 size_t s = i + malloc_mmap_start(); // cross over point 116 108 if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' || 117 109 locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "malloc/free corrupt storage" ); … … 151 143 152 144 for ( i; NoOfMmaps ) { 153 size_t s = i + default_mmap_start(); // cross over point145 size_t s = i + malloc_mmap_start(); // cross over point 154 146 char * area = (char *)calloc( 1, s ); 155 147 if ( area[0] != '\0' || area[s - 1] != '\0' ) abort( "calloc/free corrupt storage4.1" ); … … 162 154 163 155 for ( i; NoOfMmaps ) { 164 size_t s = i + default_mmap_start(); // cross over point156 size_t s = i + malloc_mmap_start(); // cross over point 165 157 locns[i] = (char *)calloc( 1, s ); 166 158 if ( locns[i][0] != '\0' || locns[i][s - 1] != '\0' || … … 171 163 } // for 172 164 for ( i; NoOfMmaps ) { 173 size_t s = i + default_mmap_start(); // cross over point165 size_t s = i + malloc_mmap_start(); // cross over point 174 166 if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' || 175 167 locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "calloc/free corrupt storage6" ); … … 198 190 //sout | alignments[a]; 199 191 for ( i; 1 ~ NoOfMmaps ) { 200 size_t s = i + default_mmap_start(); // cross over point192 size_t s = i + malloc_mmap_start(); // cross over point 201 193 char * area = (char *)memalign( a, s ); 202 194 //sout | i | area; … … 232 224 for ( i; 2 ~ NoOfAllocs ~ 12 ) { 233 225 // initial N byte allocation 234 size_t s = i + default_mmap_start(); // cross over point226 size_t s = i + malloc_mmap_start(); // cross over point 235 227 char * area = (char *)malloc( s ); 236 228 area[0] = '\345'; area[s - 1] = '\345'; // fill first/penultimate byte … … 269 261 for ( i; 2 ~ NoOfAllocs ~ 12 ) { 270 262 // initial N byte allocation 271 size_t s = i + default_mmap_start(); // cross over point263 size_t s = i + malloc_mmap_start(); // cross over point 272 264 char * area = (char *)malloc( s ); 273 265 area[0] = '\345'; area[s - 1] = '\345'; // fill first/penultimate byte … … 307 299 for ( i; 1 ~ 10_000 ~ 12 ) { 308 300 // initial N byte allocation 309 size_t s = i + default_mmap_start(); // cross over point301 size_t s = i + malloc_mmap_start(); // cross over point 310 302 char * area = (char *)calloc( 1, s ); 311 303 if ( area[0] != '\0' || area[s - 1] != '\0' || … … 481 473 482 474 int main() { 483 const unsigned int NoOfWorkers = 4;475 enum { NoOfWorkers = 4 }; 484 476 { 485 477 processor processors[NoOfWorkers - 1] __attribute__(( unused )); // more than one processor
Note: See TracChangeset
for help on using the changeset viewer.