tiny.deadalloc.Config
Defined in tiny.deadalloc.
API (10)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/deadalloc/src/allocator.zig:22
zig
pub const Config = struct { mode: Mode = .diehard, numerator: usize = 8, denominator: usize = 7, seed: u64 = 0xd1e4_a110_cafe_f00d, thread_safe: bool = true, min_chunk_blocks: usize = 64, diagnostics: DiagnosticConfig = .{}, repairs: exterminator.RepairTable = .{}, pub fn diagnostic(mode: Mode) Config { return .{ .mode = mode, .diagnostics = .{ .enabled = true }, }; } pub fn repaired(current: Config, report: report_mod.Report) Config { var next = current; const policy = exterminator.RepairPolicy.fromReport(report, .{ .red_zone_bytes = current.diagnosticRedZoneBytes(), .quarantine_epochs = current.quarantineEpochs(), .repairs = current.repairs, }); next.mode = .exterminator; next.diagnostics.enabled = true; next.diagnostics.red_zone_bytes = policy.red_zone_bytes; next.diagnostics.quarantine_epochs = policy.quarantine_epochs; next.repairs = policy.repairs; return next; } fn diagnosticRedZoneBytes(self: Config) usize { if (self.diagnostics.enabled or self.mode == .exterminator) return self.diagnostics.red_zone_bytes; return 0; } fn quarantineEpochs(self: Config) u64 { return switch (self.mode) { .diehard => 0, .dieharder => @max(self.diagnostics.quarantine_epochs, 8), .exterminator => @max(self.diagnostics.quarantine_epochs, 1), }; } fn repairPadding(self: Config, allocation_return_address: usize) usize { if (self.mode != .exterminator) return 0; return self.repairs.overflowPadding(allocation_return_address); } fn repairQuarantineEpochs(self: Config, allocation_return_address: usize, free_return_address: usize) u64 { const base = self.quarantineEpochs(); if (self.mode != .exterminator) return base; return @max(base, self.repairs.lifeExtension(allocation_return_address, free_return_address)); }};Source: lib/deadalloc/src/root.zig:45
zig
pub const Config = allocator_mod.Config;Complete caller list for Config.diagnostic
14 direct callers.
lib.deadalloc.src.allocator.test_deinit_releases_reported_large_leaks[function] — test source atlib/deadalloc/src/allocator.zig:1660in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_freed_patterns_detect_fixed_fill_byte_writes[function] — test source atlib/deadalloc/src/allocator.zig:1556in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_invalid_free_reports_interior_allocation_context[function] — test source atlib/deadalloc/src/allocator.zig:1413in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_raw_remap_rejects_freed_allocation[function] — test source atlib/deadalloc/src/allocator.zig:1450in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_raw_remap_rejects_unknown_allocation[function] — test source atlib/deadalloc/src/allocator.zig:1436in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_report_detects_live_red_zone_overflow_once[function] — test source atlib/deadalloc/src/allocator.zig:1585in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_report_detects_stale_large_writes_while_quarantined[function] — test source atlib/deadalloc/src/allocator.zig:1603in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_report_detects_stale_small_writes_before_reuse[function] — test source atlib/deadalloc/src/allocator.zig:1516in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_report_includes_bounded_leak_issues[function] — test source atlib/deadalloc/src/allocator.zig:1493in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_report_retains_structured_issue_history[function] — test source atlib/deadalloc/src/allocator.zig:1465in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_report_scans_entire_freed_small_block[function] — test source atlib/deadalloc/src/allocator.zig:1534in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_diagnostic_resize_checks_existing_red_zone_before_updating_size[function] — test source atlib/deadalloc/src/allocator.zig:1572in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_exterminator_mode_reports_invalid_free_double_free_overflow_and_leaks[function] — test source atlib/deadalloc/src/allocator.zig:1389in nearest public ownerlib.deadalloc.src.allocatorlib.deadalloc.src.allocator.test_repair_config_applies_overflow_padding_by_allocation_site[function] — test source atlib/deadalloc/src/allocator.zig:1324in nearest public ownerlib.deadalloc.src.allocator
Audit
| Definitions | 3 |
|---|---|
| Public names | 3 |
| Members | 8 |
| Version | 26.7.0 |
| Revision | daab053ee433 |