• Vicent Marti's avatar
    memleak: Resolve stacks with a StackTrace table · e25ae03e
    Vicent Marti authored
    Instead of manually walking the (kernel) stack inside the eBPF code,
    create a `BPF_STACK_TRACE` table and store the stack IDs in the alloc
    info struct.
    
    This greatly simplifies the leak detection code: instead of storing the
    full stack trace as a string to de-duplicate the allocation point for
    the different allocations, we can store the `stack_id`. Since we're
    creating stack IDs with `BPF_F_REUSE_STACKID`, the kernel will take care
    of deduplication for us.
    
    Additionally, the `StackDecoder` class has been specialized into a
    `UStackDecoder` and `KStackDecoder` (for userland and kernel stacks,
    respectively). This lets us pass the decode class directly to
    `stack_traces.walk()` to automate symbol resolution.
    
    A new class, `Allocation` has been created to encapsulate what
    previously was a 2-element tuple of `(count, size)`. This
    e25ae03e
memleak.8 3.71 KB