Skip to main content

detect_slice

Function detect_slice 

Source
pub fn detect_slice(
    records: &[InferenceRecord],
    allocations: &[ActiveAllocation],
    range_map: &RangeMap,
) -> Vec<RelationEdge>
Expand description

Detect Slice relationships for all allocations.

A Slice edge A → B is created when:

  1. A’s pointer falls strictly inside B’s range: B.start < A.ptr < B.end
  2. A’s memory range fits within B: A.ptr + A.size <= B.end
  3. A is small enough: A.size <= MAX_SLICE_SIZE
  4. A is inferred as FatPtr type (reduces false positives)

§Arguments

  • records - All inference records with allocation metadata.
  • allocations - Original allocations list for address range lookup.
  • range_map - Pre-built RangeMap for O(log n) address lookups.