Added MemoryManager, new memory properties, improved performance, updated RakLib, fixed misc. bugs

This commit is contained in:
Shoghi Cervantes
2015-04-18 20:13:52 +02:00
parent ddc152ae0a
commit b2c25eaf36
32 changed files with 652 additions and 164 deletions

View File

@ -314,6 +314,24 @@ namespace pocketmine {
}
}
/**
* @param object $value
* @param bool $includeCurrent
*
* @return int
*/
function getReferenceCount($value, $includeCurrent = true){
ob_start();
debug_zval_dump($value);
$ret = explode("\n", ob_get_contents());
ob_end_clean();
if(count($ret) >= 1 and preg_match('/^.* refcount\\(([0-9]+)\\)\\{$/', trim($ret[0]), $m) > 0){
return ((int) $m[1]) - ($includeCurrent ? 3 : 4); //$value + zval call + extra call
}
return -1;
}
function getTrace($start = 1, $trace = null){
if($trace === null){
if(function_exists("xdebug_get_function_stack")){