// What the Sites app tells the core of its pages' memory (`SitesMemory`, SITES 5), moved here from Comms' session// screen when Sites left Comms (COMMS WITHOUT MAIL, 26 Nov 2026): figures only, nothing of a page.#if os(iOS)importFoundationimport os/// The core's `SitesMemory` (SITES 5): figures only, nothing of a page.structSitesFigures: Encodable, Equatable {var alive: UInt32 = 0var mostAlive: UInt32 = 0var limit: UInt32var letGo: UInt64 = 0var warnings: UInt64 = 0var webEnded: UInt64 = 0var peakFootprintMb: UInt64?var leastHeadroomMb: UInt64?/// The app's own footprint now, in MB (what iOS counts against it). A web page's own process is not given to an app.staticfunc footprintMB() -> UInt64? {var info = task_vm_info_data_t()var count = mach_msg_type_number_t(MemoryLayout<task_vm_info_data_t>.size / MemoryLayout<natural_t>.size)let result = withUnsafeMutablePointer(to: &info) { $0.withMemoryRebound(to: integer_t.self, capacity: Int(count)) { task_info(mach_task_self_, task_flavor_t(TASK_VM_INFO), $0, &count) } }return result == KERN_SUCCESS ? info.phys_footprint / 1_048_576 : nil }/// How much more the app may take before iOS ends it, in MB (none on the simulator).staticfunc headroomMB() -> UInt64? {let left = os_proc_available_memory()return left > 0 ? UInt64(left) / 1_048_576 : nil }}#endif