Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding variable and function names to heapgraph and objprof #8622

Open
andrewjtimmons opened this issue Dec 6, 2019 · 4 comments
Open

Adding variable and function names to heapgraph and objprof #8622

andrewjtimmons opened this issue Dec 6, 2019 · 4 comments
Assignees

Comments

@andrewjtimmons
Copy link

andrewjtimmons commented Dec 6, 2019

HHVM Version

hhvm --version
HipHop VM 4.13.2 (rel)
hh_client --version
hackc-a6fd900a34a498abea492c9bcb9045ee5e9cb7f3-4.13.2

Standalone code, or other way to reproduce the problem

Run the following script:

<?hh //strict

class SimpleProps { 
	private string $prop1 = "one";
	protected int $prop2 = 2;
	public bool $prop3 = true;
}

<<__EntryPoint>>
function local_oom_cli(): void {

	$ducks = ["quack"];
	$string = 'thank_you_for_being_you';
	$testclass = new SimpleProps();
	$int_val = local_test_func();

	$obj = heapgraph_create();
	$stat = heapgraph_stats($obj);
	var_dump($stat);
	$n = heapgraph_node($obj, 1);
	var_dump("vardump-ing nodes");
	heapgraph_foreach_node($obj, "var_dump");

	var_dump("vardump-ing objprof");
	$obj_prof = objprof_get_data();
	var_dump($obj_prof);
}

function local_test_func(): int {
	return 1;
}

You will get the result (most nodes from heapgraph_foreach_node($obj, "var_dump"); removed, but there are many more String and other nodes with out a ton of other identifying information

array(5) {
  ["nodes"]=>
  int(243)
  ["edges"]=>
  int(152)
  ["roots"]=>
  int(22)
  ["root_nodes"]=>
  int(112)
  ["exact"]=>
  int(0)
}
string(17) "vardump-ing nodes"
array(3) {
  ["index"]=>
  int(0)
  ["kind"]=>
  string(12) "GlobalsArray"
  ["size"]=>
  int(32)
}
array(4) {
  ["index"]=>
  int(57)
  ["kind"]=>
  string(6) "Object"
  ["size"]=>
  int(64)
  ["class"]=>
  string(11) "SimpleProps"
}
array(3) {
  ["index"]=>
  int(129)
  ["kind"]=>
  string(6) "String"
  ["size"]=>
  int(48)
}
array(3) {
  ["index"]=>
  int(130)
  ["kind"]=>
  string(11) "SmallMalloc"
  ["size"]=>
  int(14336)
}
array(3) {
  ["index"]=>
  int(131)
  ["kind"]=>
  string(4) "Root"
  ["size"]=>
  int(152)
}

string(19) "vardump-ing objprof"
array(1) {
  ["SimpleProps"]=>
  array(4) {
    ["instances"]=>
    int(1)
    ["bytes"]=>
    int(67)
    ["bytes_normalized"]=>
    float(64)
    ["paths"]=>
    NULL
  }
}

It would be nice if

A) heapgraph could include var names in nodes so we can tie those to vars much like one can with classes

array(4) {
  ["index"]=>
  int(57)
  ["kind"]=>
  string(6) "Object"
  ["size"]=>
  int(64)
  ["class"]=>
  string(11) "SimpleProps"
}

B) if obj prof could do the same

https://github.com/facebook/hhvm/tree/master/hphp/runtime/ext/objprof

I spoke with Alex Toptygin and he suggested this might be possible.

@fredemmott
Copy link
Contributor

fb T58748270

@alexeyt
Copy link
Contributor

alexeyt commented Dec 10, 2019

I don't think we want to include objprof in this; I think we should view objprof as in maintenance mode only, and new feature development should focus on heapgraph.

@andrewjtimmons
Copy link
Author

That is fair. Let's ignore objprof if it is in maintenance mode and only worry about heapgraph.

@andrewjtimmons
Copy link
Author

Good afternoon @fredemmott and @alexeyt! I was wondering if there is a status update for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants