Changes in tests/collections/string-gc.cfa [7b0e8b7:6cc87c0]
- File:
-
- 1 edited
-
tests/collections/string-gc.cfa (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/collections/string-gc.cfa
r7b0e8b7 r6cc87c0 2 2 3 3 size_t bytesRemaining() { 4 return DEBUG_string_bytes_avail_until_gc( DEBUG_string_heap ());4 return DEBUG_string_bytes_avail_until_gc( DEBUG_string_heap ); 5 5 } 6 6 7 7 size_t heapOffsetStart( string_res & s ) { 8 const char * startByte = DEBUG_string_heap_start( DEBUG_string_heap ());8 const char * startByte = DEBUG_string_heap_start( DEBUG_string_heap ); 9 9 assert( s.Handle.s >= startByte ); 10 10 return s.Handle.s - startByte; … … 120 120 } 121 121 122 void fillNoCompact() {123 // show that allocating in a heap filled with mostly live strings (no collectable garbage) causes heap growth124 125 sout | "======================== fillNoCompact";126 127 size_t lastTimeBytesAvail = bytesRemaining();128 assert( lastTimeBytesAvail >= 200 ); // starting this test with nontrivial room129 130 // mostly fill the pad131 string_res a = "aaa"; // will have to be moved132 string_res z = "zzz";133 for (i; 5) {134 while ( bytesRemaining() > 10 ) {135 z += ".";136 }137 sout | "about to expand, a = " | a;138 while ( bytesRemaining() <= 10 ) {139 z += ".";140 }141 sout | "expanded, a = " | a;142 143 // each growth gives more usable space than the last144 assert( bytesRemaining() > lastTimeBytesAvail );145 lastTimeBytesAvail = bytesRemaining();146 }147 }148 149 122 int main() { 150 123 basicFillCompact(); 151 124 fillCompact_withSharedEdits(); 152 fillNoCompact();153 125 }
Note:
See TracChangeset
for help on using the changeset viewer.