Use reserved spans to fulfill a memory map request (reserve size must be checked by caller)
| 1144 | |
| 1145 | //! Use reserved spans to fulfill a memory map request (reserve size must be checked by caller) |
| 1146 | static span_t* |
| 1147 | _rpmalloc_span_map_from_reserve(heap_t* heap, size_t span_count) { |
| 1148 | //Update the heap span reserve |
| 1149 | span_t* span = heap->span_reserve; |
| 1150 | heap->span_reserve = (span_t*)pointer_offset(span, span_count * _memory_span_size); |
| 1151 | heap->spans_reserved -= (uint32_t)span_count; |
| 1152 | |
| 1153 | _rpmalloc_span_mark_as_subspan_unless_master(heap->span_reserve_master, span, span_count); |
| 1154 | if (span_count <= LARGE_CLASS_COUNT) |
| 1155 | _rpmalloc_stat_inc(&heap->span_use[span_count - 1].spans_from_reserved); |
| 1156 | |
| 1157 | return span; |
| 1158 | } |
| 1159 | |
| 1160 | //! Get the aligned number of spans to map in based on wanted count, configured mapping granularity and the page size |
| 1161 | static size_t |
no test coverage detected