| 26 | } |
| 27 | |
| 28 | static void thread_alloc(fast_allocator_regression_test* This) |
| 29 | { |
| 30 | FastAllocator::CachedAllocator threadalloc = This->alloc->getCachedAllocator(); |
| 31 | |
| 32 | size_t* ptrs[1000]; |
| 33 | for (size_t j=0; j<1000; j++) |
| 34 | { |
| 35 | This->barrier.wait(); |
| 36 | for (size_t i=0; i<1000; i++) { |
| 37 | ptrs[i] = (size_t*) threadalloc.malloc0(sizeof(size_t)+(i%32)); |
| 38 | *ptrs[i] = size_t(threadalloc.talloc0) + i; |
| 39 | } |
| 40 | for (size_t i=0; i<1000; i++) { |
| 41 | if (*ptrs[i] != size_t(threadalloc.talloc0) + i) |
| 42 | This->numFailed++; |
| 43 | } |
| 44 | This->barrier.wait(); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | bool run () |
| 49 | { |