Skip to content

proposal: scan and record memory partially #71

@Lslightly

Description

@Lslightly

Is your feature request related to a problem? Please describe.

When the memory footprint is large, we may only consider some part of objects, which can reduce the size of generated profile.
Although pprof provides show_from and focus options to hide other parts of objects, there may be cases we need to consider two isolated parts of memory at the same time.

Describe the solution you'd like

Intrusively add a stub pointer field to the struct types of interest within the program under test. Then goref can trace objects reachable from struct objects which holds the stub address provided by goref.

Describe alternatives you've considered

Write goref profile parser and consider interested objects only. But it seems not convenient as this approach.
But stub field in the proposal causes more memory consumption for objects which contain the field.

Additional context

I've implemented the idea in markStub branch. It supports adding a stub pointer in objects of struct type. Then goref will only trace objects reachable from those objects that contain the stub address.

test/testdata/stubaddr/main.go is a demo program to show how markStub can be used to trace certain objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions