%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#88C0D0', 'primaryTextColor': '#000', 'primaryBorderColor': '#333'}}}%% pie title Where does your C++ RAM go? "unordered_map overhead" : 35 "Unnecessary copies / temps" : 25 "Cached data (never freed)" : 20 "Container overhead (list, ptr)" : 15 "Actual useful data" : 5
graph TD subgraph "Before: Triple Storage โ" M1["owned_nodes\nvector<unique_ptr>"] -->|heap alloc| N1["Node"] M2["nodes\nunordered_map<string, ptr>"] -->|hash + string| N1 M3["source_node\nby-value member"] --> N1 end subgraph "After: Single Arena โ " A1["_arena\ndeque<RoutingNode>"] -->|contiguous| N2["All Nodes"] M4["nodes\nunordered_map<string, ptr>"] -->|into arena| N2 end style M1 fill:#ffcdd2 style M2 fill:#ffcdd2 style M3 fill:#ffcdd2 style A1 fill:#c8e6c9 style M4 fill:#bbdefb
graph TD subgraph Flat["Flat Processing - HIGH Memory โ"] A["Full Chip Data"] --> B["Synthesis"] A --> C["Routing"] A --> D["Analysis"] end subgraph Hierarchical["Hierarchical Processing - LOW Memory โ "] E["Top-Level Shell"] --> F["Block A Model"] E --> G["Block B Model"] E --> H["Block C Model"] F --> I["Process A Independently"] G --> J["Process B Independently"] H --> K["Process C Independently"] end style Flat fill:#ffcdd2 style Hierarchical fill:#c8e6c9
graph LR subgraph Client["Client: Extrinsic Data"] T1["Tree 1: X=10, Y=5"] T2["Tree 2: X=20, Y=8"] Tn["Tree N: X=..."] end subgraph Factory["Flyweight Factory: Cache"] F1["Oak Mesh โ "] F2["Pine Mesh โ "] end T1 -->|ref| F1 T2 -->|ref| F2 Tn -->|ref| F1 style Factory fill:#bbdefb style Client fill:#fff9c4
graph LR A["Your Application"] --> B{"Profile It"} B --> C["C++: Valgrind / Heaptrack"] B --> D["Java: JVisualVM / JProfiler"] B --> E["Python: memory_profiler"] B --> F["OS: /proc/pid/smaps"] C & D & E & F --> G["Identify Top 20% Consumers"] G --> H["Apply Patterns"] style G fill:#f96,stroke-width:2px style H fill:#6f9
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#4CAF50', 'primaryTextColor': '#fff'}}}%% graph LR A["๐ Faster App"] --> B["โ Less RAM"] B --> C["๐ฐ Lower Costs"] C --> D["๐ Happy Users"] style A fill:#4CAF50,color:#fff style D fill:#88C0D0,color:#fff