Changes in libcfa/src/heap.cfa [0f89d4f:2b23d78]
- File:
-
- 1 edited
-
libcfa/src/heap.cfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/heap.cfa
r0f89d4f r2b23d78 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 15:08:49202013 // Update Count : 77012 // Last Modified On : Mon Jul 20 23:00:32 2020 13 // Update Count : 808 14 14 // 15 15 … … 208 208 209 209 #if BUCKETLOCK == LOCKFREE 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 & ) {} 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 213 215 #endif // LOCKFREE 214 216 … … 899 901 if ( oalign == 0 && size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size 900 902 header->kind.real.blockSize &= -2; // no alignment and turn off 0 fill 903 if ( size != odsize ) header->kind.real.size = size; // reset allocation size 901 904 return oaddr; 902 905 } // if … … 927 930 928 931 size_t odsize = dataStorage( bsize, oaddr, header ); // data storage available in bucket 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. 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 932 934 return oaddr; 933 935 } // if … … 1096 1098 // Returns original total allocation size (not bucket size) => array size is dimension * sizeif(T). 1097 1099 size_t malloc_size( void * addr ) { 1098 if ( unlikely( addr == 0p ) ) return false; // null allocation is not zero fill1100 if ( unlikely( addr == 0p ) ) return 0; // null allocation has zero size 1099 1101 HeapManager.Storage.Header * header = headerAddr( addr ); 1100 1102 if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ? … … 1106 1108 // Set allocation size and return previous size. 1107 1109 size_t $malloc_size_set( void * addr, size_t size ) { 1108 if ( unlikely( addr == 0p ) ) return false; // null allocation is not zero fill1110 if ( unlikely( addr == 0p ) ) return 0; // null allocation has 0 size 1109 1111 HeapManager.Storage.Header * header = headerAddr( addr ); 1110 1112 if ( (header->kind.fake.alignment & 1) == 1 ) { // fake header ? … … 1225 1227 if ( size <= odsize && odsize <= size * 2 ) { // allow 50% wasted storage for smaller size 1226 1228 header->kind.real.blockSize &= -2; // turn off 0 fill 1229 if ( size != odsize ) header->kind.real.size = size; // reset allocation size 1227 1230 return oaddr; 1228 1231 } // if
Note:
See TracChangeset
for help on using the changeset viewer.