For reference, the average total _allocation count_ for a table is: + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables[]) + 1 (for table->RawData allocated below) + 1 (for table->ColumnsNames, if names are used) Shared allocations for the maximum number of simultaneously nested tables (generally a very small number) + 1 (for table->Splitter._Channels) + 2 * active_channels_count
| 595 | // Where active_channels_count is variable but often == columns_count or == columns_count + 1, see TableSetupDrawChannels() for details. |
| 596 | // Unused channels don't perform their +2 allocations. |
| 597 | void ImGui::TableBeginInitMemory(ImGuiTable* table, int columns_count) |
| 598 | { |
| 599 | // Allocate single buffer for our arrays |
| 600 | const int columns_bit_array_size = (int)ImBitArrayGetStorageSizeInBytes(columns_count); |
| 601 | ImSpanAllocator<6> span_allocator; |
| 602 | span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn)); |
| 603 | span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx)); |
| 604 | span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4); |
| 605 | for (int n = 3; n < 6; n++) |
| 606 | span_allocator.Reserve(n, columns_bit_array_size); |
| 607 | table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes()); |
| 608 | memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes()); |
| 609 | span_allocator.SetArenaBasePtr(table->RawData); |
| 610 | span_allocator.GetSpan(0, &table->Columns); |
| 611 | span_allocator.GetSpan(1, &table->DisplayOrderToIndex); |
| 612 | span_allocator.GetSpan(2, &table->RowCellData); |
| 613 | table->EnabledMaskByDisplayOrder = (ImU32*)span_allocator.GetSpanPtrBegin(3); |
| 614 | table->EnabledMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(4); |
| 615 | table->VisibleMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(5); |
| 616 | } |
| 617 | |
| 618 | // Apply queued resizing/reordering/hiding requests |
| 619 | void ImGui::TableBeginApplyRequests(ImGuiTable* table) |
nothing calls this directly
no test coverage detected