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.
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_fromandfocusoptions 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
stubpointer 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
stubfield 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
markStubcan be used to trace certain objects.