Changes in libcfa/src/heap.cfa [2b23d78:0f89d4f]
- File:
-
- 1 edited
-
libcfa/src/heap.cfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/heap.cfa
r2b23d78 r0f89d4f 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 20 23:00:32202013 // Update Count : 80812 // Last Modified On : Wed May 27 15:08:49 2020 13 // Update Count : 770 14 14 // 15 15 … … 208 208 209 209 #if BUCKETLOCK == LOCKFREE 210 static inline { 211 Link(HeapManager.Storage) * ?`next( HeapManager.Storage * this ) { return &this->header.kind.real.next; } 212 void ?{}( HeapManager.FreeHeader & ) {} 213 void ^?{}( HeapManager.FreeHeader & ) {} 214 } // distribution 210 static inline Link(HeapManager.Storage) * ?`next( HeapManager.Storage * this ) { return &this->header.kind.real.next; } 211 static inline void ?{}( HeapManager.FreeHeader & ) {} 212 static inline void ^?{}( HeapManager.FreeHeader & ) {} 215 213 #endif // LOCKFREE 216 214 … … 901 899 if ( oalign == 0 && size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size 902 900 header->kind.real.blockSize &= -2; // no alignment and turn off 0 fill 903 if ( size != odsize ) header->kind.real.size = size; // reset allocation size904 901 return oaddr; 905 902 } // if … … 930 927 931 928 size_t odsize = dataStorage( bsize, oaddr, header ); // data storage available in bucket 932 if ( size <= odsize && odsize <= size * 2 ) { // allow up to 50% wasted storage in smaller size 933 if ( size != odsize ) header->kind.real.size = size; // reset allocation size 929 if ( size <= odsize && odsize <= size * 2 ) { // allow up to 50% wasted storage in smaller size 930 // Do not know size of original allocation => cannot do 0 fill for any additional space because do not know 931 // where to start filling, i.e., do not overwrite existing values in space. 934 932 return oaddr; 935 933 } // if … … 1098 1096 // Returns original total allocation size (not bucket size) => array size is dimension * sizeif(T). 1099 1097 size_t malloc_size( void * addr ) { 1100 if ( unlikely( addr == 0p ) ) return 0; // null allocation has zero size1098 if ( unlikely( addr == 0p ) ) return false; // null allocation is not zero fill 1101 1099 HeapManager.Storage.Header * header = headerAddr( addr ); 1102 1100 if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ? … … 1108 1106 // Set allocation size and return previous size. 1109 1107 size_t $malloc_size_set( void * addr, size_t size ) { 1110 if ( unlikely( addr == 0p ) ) return 0; // null allocation has 0 size1108 if ( unlikely( addr == 0p ) ) return false; // null allocation is not zero fill 1111 1109 HeapManager.Storage.Header * header = headerAddr( addr ); 1112 1110 if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ? … … 1227 1225 if ( size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size 1228 1226 header->kind.real.blockSize &= -2; // turn off 0 fill 1229 if ( size != odsize ) header->kind.real.size = size; // reset allocation size1230 1227 return oaddr; 1231 1228 } // if
Note:
See TracChangeset
for help on using the changeset viewer.