equal
deleted
inserted
replaced
102 template <class T, MEMFLAGS flags, size_t alignment = DEFAULT_CACHE_LINE_SIZE> |
102 template <class T, MEMFLAGS flags, size_t alignment = DEFAULT_CACHE_LINE_SIZE> |
103 class Padded2DArray { |
103 class Padded2DArray { |
104 public: |
104 public: |
105 // Creates an aligned padded 2D array. |
105 // Creates an aligned padded 2D array. |
106 // The memory cannot be deleted since the raw memory chunk is not returned. |
106 // The memory cannot be deleted since the raw memory chunk is not returned. |
|
107 // Always uses mmap to reserve memory. Only the first few pages with the index to |
|
108 // the rows are touched. Allocation size should be "large" to cover page overhead. |
107 static T** create_unfreeable(uint rows, uint columns, size_t* allocation_size = NULL); |
109 static T** create_unfreeable(uint rows, uint columns, size_t* allocation_size = NULL); |
108 }; |
110 }; |
109 |
111 |
110 // Helper class to create an array of T objects. The array as a whole will |
112 // Helper class to create an array of T objects. The array as a whole will |
111 // start at a multiple of alignment and its size will be aligned to alignment. |
113 // start at a multiple of alignment and its size will be aligned to alignment. |