Adding variable and function names to heapgraph and objprof
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
### 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:
```
>
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.
Contributor guide
Assessment
This issue has not been assessed yet.